Changeset 3e94658359c07330b5ea11ae8520fd41e676bba5

Show
Ignore:
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:
3 modified

Legend:

Unmodified
Added
Removed
  • TODO

    r10a572 r577f16  
    2525  - Make BitVector run as fast as bitset from C++ STL. See; 
    2626      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 
    2737 
    2838* Ruby bindings 
     
    6474* user defined sorting 
    6575* Fix highlighting to work for external fields 
     76* investigate faster string hashing method 
    6677 
    6778Done 
  • c/Makefile

    r613a2b r6ea76e  
    2121 
    2222CC       = gcc 
    23 CINCS    = -Iinclude -I$(STEMMER_INC) -I$(BZLIB_INC) 
     23CINCS    = -Iinclude -I$(STEMMER_INC) -I$(BZLIB_INC) -Itest 
    2424DEFS     = -DBZ_NO_STDIO -D_FILE_OFFSET_BITS=64 -DDEBUG -D_POSIX_C_SOURCE=2 
    2525DEFS    += -DHAVE_GDB 
     
    2828DEP_DIR  = .deps 
    2929GCOV_DIR = .gcov 
    30 VPATH    = test:src 
     30VPATH    = test:src:benchmark 
    3131 
    3232### 
     
    6262test_lang.o 
    6363 
     64BENCH_OBJS = benchmark.o bm_bitvector.o bm_hash.o \ 
     65             bm_micro_string.o bm_store.o         \ 
     66 
    6467BZLIB_SRCS = \ 
    6568bzlib.c blocksort.c compress.c crctable.c decompress.c huffman.c randtable.c 
     
    6972STEMMER_OBJS = $(snowball_sources:%.c=$(STEMMER_DIR)/%.o) 
    7073 
    71 FRT_OBJS = $(OBJS) $(TEST_OBJS) 
     74FRT_OBJS = $(OBJS) $(TEST_OBJS) $(BENCH_OBJS) 
    7275EXT_OBJS = $(BZLIB_OBJS) $(STEMMER_OBJS) 
    7376 
     
    8891testall: $(TEST_OBJS) libferret.a 
    8992        @echo Building task: $@ ... 
    90         $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 
     93        @$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 
     94 
     95benchall: $(BENCH_OBJS) libferret.a 
     96        @echo Building task: $@ ... 
     97        @$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 
     98 
     99bench: benchall 
     100        @./benchall 
    91101 
    92102clean: 
     
    124134                 --gen-suppressions=yes       \ 
    125135                 --workaround-gcc296-bugs=yes -v ./testall -q 
    126  
    127 ### 
    128 # Benchmarking 
    129 ### 
    130  
    131 # TODO 
    132136 
    133137### 
     
    176180### 
    177181 
    178 .PHONY: clean all test gcov gprof valgrind gen_valsupp 
     182.PHONY: clean all test bench gcov gprof valgrind gen_valsupp 
  • c/benchmark/benchmark.c

    r50f9ff r521506  
    1 #include <sys/times.h> 
    21#include <sys/time.h> 
     2#include <sys/resource.h> 
    33#include <unistd.h> 
    4 #include <limits.h> 
    54#include <string.h> 
    65#include "global.h" 
     
    98#include "word_list.h" 
    109 
    11 static int hertz; 
    12  
    1310static int bmtcmp(const void *p1, const void *p2) 
    1411{ 
    1512    BenchMarkTimes *bmt1 = *(BenchMarkTimes **)p1; 
    1613    BenchMarkTimes *bmt2 = *(BenchMarkTimes **)p2; 
    17      
     14 
    1815    if (bmt1->rtime > bmt2->rtime) return 1; 
    1916    else if (bmt1->rtime < bmt2->rtime) return -1; 
     
    6057} 
    6158 
     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 
    6263static void bm_single_run(BenchMarkUnit *unit, BenchMarkTimes *bm_times) 
    6364{ 
    6465    struct timeval tv_before, tv_after; 
    65     struct tms tms_before, tms_after; 
    66     double before, after; 
     66    struct rusage ru_before, ru_after; 
    6767 
    6868    if (gettimeofday(&tv_before, NULL) == -1) 
    6969        RAISE(FRT_UNSUPPORTED_ERROR, "gettimeofday failed\n"); 
    70     (void)times(&tms_before); 
     70    getrusage(RUSAGE_SELF, &ru_before); 
    7171 
    7272    unit->run(); 
     
    7474    if (gettimeofday(&tv_after, NULL) == -1) 
    7575        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); 
    8481} 
    8582 
     
    132129        DO_TEARDOWN(benchmark); 
    133130    } 
    134      
     131 
    135132    /* get maximum unit name length for print out */ 
    136133    for (unit = benchmark->head; unit; unit = unit->next) { 
     
    159156    (void)argc; (void)argv; 
    160157    benchmark.head = benchmark.tail = NULL; 
    161     /* set the clock speed used for calculating run times */ 
    162     hertz = sysconf(_SC_CLK_TCK); 
    163158 
    164159    for (i = 0; i < NELEMS(all_benchmarks); i++) {