Changeset 3e94658359c07330b5ea11ae8520fd41e676bba5
- Timestamp:
- 04/21/08 03:45:43 (9 months ago)
- Author:
- krayouva <krayouva@…>
- Parents:
- 52150679808ed6ea37f1eb4c564756a1894e43d6, efd6cf5568bba67ec0b7453c93aa3e0c862d864a
- Children:
- 585583fabc2d8f758ad113f07b02b6e37e03ca63, 7ef4a33027485f8cdf5bf9ae4e417537317e80d8, 4640c75a8385ecb909a2b09d28eca23a6c4f6130
- git-committer:
- krayouva <krayouva@gmail.com> / 2008-04-20T13:45:43Z-0400
- Message:
-
Merge branch 'master' of ssh://git@davebalmain.com/var/git/ferret
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r10a572
|
r577f16
|
|
| 25 | 25 | - Make BitVector run as fast as bitset from C++ STL. See; |
| 26 | 26 | c/benchmark/bm_bitvector.c |
| | 27 | - Add a symbol table for field names. This will mean that we won't need to |
| | 28 | worry about mallocing and freeing field names which happens all over the |
| | 29 | place. |
| | 30 | - Divide the headers into public and private (the private headers to be |
| | 31 | stored in the src directory). |
| | 32 | - Group-by search. ie you should be able to pass a field to group search |
| | 33 | results by |
| | 34 | - Auto-loading of documents during search. ie actual documents get returned |
| | 35 | instead of document numbers. |
| | 36 | - update benchmark suite to use getrusage.u |
| 27 | 37 | |
| 28 | 38 | * Ruby bindings |
| … |
… |
|
| 64 | 74 | * user defined sorting |
| 65 | 75 | * Fix highlighting to work for external fields |
| | 76 | * investigate faster string hashing method |
| 66 | 77 | |
| 67 | 78 | Done |
-
|
r613a2b
|
r6ea76e
|
|
| 21 | 21 | |
| 22 | 22 | CC = gcc |
| 23 | | CINCS = -Iinclude -I$(STEMMER_INC) -I$(BZLIB_INC) |
| | 23 | CINCS = -Iinclude -I$(STEMMER_INC) -I$(BZLIB_INC) -Itest |
| 24 | 24 | DEFS = -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -DDEBUG -D_POSIX_C_SOURCE=2 |
| 25 | 25 | DEFS += -DHAVE_GDB |
| … |
… |
|
| 28 | 28 | DEP_DIR = .deps |
| 29 | 29 | GCOV_DIR = .gcov |
| 30 | | VPATH = test:src |
| | 30 | VPATH = test:src:benchmark |
| 31 | 31 | |
| 32 | 32 | ### |
| … |
… |
|
| 62 | 62 | test_lang.o |
| 63 | 63 | |
| | 64 | BENCH_OBJS = benchmark.o bm_bitvector.o bm_hash.o \ |
| | 65 | bm_micro_string.o bm_store.o \ |
| | 66 | |
| 64 | 67 | BZLIB_SRCS = \ |
| 65 | 68 | bzlib.c blocksort.c compress.c crctable.c decompress.c huffman.c randtable.c |
| … |
… |
|
| 69 | 72 | STEMMER_OBJS = $(snowball_sources:%.c=$(STEMMER_DIR)/%.o) |
| 70 | 73 | |
| 71 | | FRT_OBJS = $(OBJS) $(TEST_OBJS) |
| | 74 | FRT_OBJS = $(OBJS) $(TEST_OBJS) $(BENCH_OBJS) |
| 72 | 75 | EXT_OBJS = $(BZLIB_OBJS) $(STEMMER_OBJS) |
| 73 | 76 | |
| … |
… |
|
| 88 | 91 | testall: $(TEST_OBJS) libferret.a |
| 89 | 92 | @echo Building task: $@ ... |
| 90 | | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ |
| | 93 | @$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ |
| | 94 | |
| | 95 | benchall: $(BENCH_OBJS) libferret.a |
| | 96 | @echo Building task: $@ ... |
| | 97 | @$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ |
| | 98 | |
| | 99 | bench: benchall |
| | 100 | @./benchall |
| 91 | 101 | |
| 92 | 102 | clean: |
| … |
… |
|
| 124 | 134 | --gen-suppressions=yes \ |
| 125 | 135 | --workaround-gcc296-bugs=yes -v ./testall -q |
| 126 | | |
| 127 | | ### |
| 128 | | # Benchmarking |
| 129 | | ### |
| 130 | | |
| 131 | | # TODO |
| 132 | 136 | |
| 133 | 137 | ### |
| … |
… |
|
| 176 | 180 | ### |
| 177 | 181 | |
| 178 | | .PHONY: clean all test gcov gprof valgrind gen_valsupp |
| | 182 | .PHONY: clean all test bench gcov gprof valgrind gen_valsupp |
-
|
r50f9ff
|
r521506
|
|
| 1 | | #include <sys/times.h> |
| 2 | 1 | #include <sys/time.h> |
| | 2 | #include <sys/resource.h> |
| 3 | 3 | #include <unistd.h> |
| 4 | | #include <limits.h> |
| 5 | 4 | #include <string.h> |
| 6 | 5 | #include "global.h" |
| … |
… |
|
| 9 | 8 | #include "word_list.h" |
| 10 | 9 | |
| 11 | | static int hertz; |
| 12 | | |
| 13 | 10 | static int bmtcmp(const void *p1, const void *p2) |
| 14 | 11 | { |
| 15 | 12 | BenchMarkTimes *bmt1 = *(BenchMarkTimes **)p1; |
| 16 | 13 | BenchMarkTimes *bmt2 = *(BenchMarkTimes **)p2; |
| 17 | | |
| | 14 | |
| 18 | 15 | if (bmt1->rtime > bmt2->rtime) return 1; |
| 19 | 16 | else if (bmt1->rtime < bmt2->rtime) return -1; |
| … |
… |
|
| 60 | 57 | } |
| 61 | 58 | |
| | 59 | #define TVAL_TO_SEC(before, after) \ |
| | 60 | ((double)after.tv_sec + ((double)after.tv_usec/1000000)) - \ |
| | 61 | ((double)before.tv_sec + ((double)before.tv_usec/1000000)) |
| | 62 | |
| 62 | 63 | static void bm_single_run(BenchMarkUnit *unit, BenchMarkTimes *bm_times) |
| 63 | 64 | { |
| 64 | 65 | struct timeval tv_before, tv_after; |
| 65 | | struct tms tms_before, tms_after; |
| 66 | | double before, after; |
| | 66 | struct rusage ru_before, ru_after; |
| 67 | 67 | |
| 68 | 68 | if (gettimeofday(&tv_before, NULL) == -1) |
| 69 | 69 | RAISE(FRT_UNSUPPORTED_ERROR, "gettimeofday failed\n"); |
| 70 | | (void)times(&tms_before); |
| | 70 | getrusage(RUSAGE_SELF, &ru_before); |
| 71 | 71 | |
| 72 | 72 | unit->run(); |
| … |
… |
|
| 74 | 74 | if (gettimeofday(&tv_after, NULL) == -1) |
| 75 | 75 | RAISE(FRT_UNSUPPORTED_ERROR, "gettimeofday failed\n"); |
| 76 | | (void)times(&tms_after); |
| 77 | | before = (double)tv_before.tv_sec + ((double)tv_before.tv_usec/1000000); |
| 78 | | after = (double)tv_after.tv_sec + ((double)tv_after.tv_usec/1000000); |
| 79 | | bm_times->rtime = after - before; |
| 80 | | bm_times->utime = |
| 81 | | ((double)(tms_after.tms_utime - tms_before.tms_utime))/hertz; |
| 82 | | bm_times->stime = |
| 83 | | ((double)(tms_after.tms_stime - tms_before.tms_stime))/hertz; |
| | 76 | getrusage(RUSAGE_SELF, &ru_after); |
| | 77 | |
| | 78 | bm_times->rtime = TVAL_TO_SEC(tv_before, tv_after); |
| | 79 | bm_times->utime = TVAL_TO_SEC(ru_before.ru_utime, ru_after.ru_utime); |
| | 80 | bm_times->stime = TVAL_TO_SEC(ru_before.ru_stime, ru_after.ru_stime); |
| 84 | 81 | } |
| 85 | 82 | |
| … |
… |
|
| 132 | 129 | DO_TEARDOWN(benchmark); |
| 133 | 130 | } |
| 134 | | |
| | 131 | |
| 135 | 132 | /* get maximum unit name length for print out */ |
| 136 | 133 | for (unit = benchmark->head; unit; unit = unit->next) { |
| … |
… |
|
| 159 | 156 | (void)argc; (void)argv; |
| 160 | 157 | benchmark.head = benchmark.tail = NULL; |
| 161 | | /* set the clock speed used for calculating run times */ |
| 162 | | hertz = sysconf(_SC_CLK_TCK); |
| 163 | 158 | |
| 164 | 159 | for (i = 0; i < NELEMS(all_benchmarks); i++) { |