X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=isamb%2Fbenchindex1.c;h=fd417547e83a7b4578ebd0c23b2d244b6dded294;hp=167a4ab9274bdd7e7d17b6a9ed04f37d0f68259c;hb=d02c4c703a93e0ad3f4ccde4519879f1f57a6824;hpb=a66b7d79383ae700f3358731eecfe2aafed0e90d diff --git a/isamb/benchindex1.c b/isamb/benchindex1.c index 167a4ab..fd41754 100644 --- a/isamb/benchindex1.c +++ b/isamb/benchindex1.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2010 Index Data + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -98,10 +101,10 @@ int code_read(void *vp, char **dst, int *insertMode) if (b->current_entry >= b->no_entries) return 0; - + t = b->ar[b->current_entry]; b->current_entry++; - + key.len = 3; key.mem[0] = t->word_id; key.mem[1] = t->docid; @@ -133,7 +136,7 @@ void index_block_flush(struct index_block *b, ISAMB isb, Dict dict, zint number_of_int_splits = isamb_get_int_splits(isb); zint number_of_leaf_splits = isamb_get_leaf_splits(isb); zint number_of_dict_splits = dict_get_no_split(dict); - + b->ar = xmalloc(sizeof(*b->ar) * b->no_entries); for (i = 0; i < b->no_entries; i++, t = t->next) { @@ -141,7 +144,7 @@ void index_block_flush(struct index_block *b, ISAMB isb, Dict dict, b->ar[i] = t; } assert(!t); - + qsort(b->ar, b->no_entries, sizeof(*b->ar), cmp_ar); tim_dict = yaz_timing_create(); #if 0 @@ -187,7 +190,7 @@ void index_block_flush(struct index_block *b, ISAMB isb, Dict dict, } } dict_insert(dict, "_w", sizeof(word_id_seq), &word_id_seq); - + yaz_timing_stop(tim_dict); tim_isamb = yaz_timing_create(); @@ -196,7 +199,7 @@ void index_block_flush(struct index_block *b, ISAMB isb, Dict dict, if (b->no_entries) { ISAMC_I isamc_i; - + isamc_i.clientData = b; isamc_i.read_item = code_read; @@ -219,7 +222,7 @@ void index_block_flush(struct index_block *b, ISAMB isb, Dict dict, } b->round++; printf("%5d %9.6f %9.6f %5.2f %5.2f %9.6f %5.2f %5.2f " - "%6" ZINT_FORMAT0 " %6" ZINT_FORMAT0 + "%6" ZINT_FORMAT0 " %6" ZINT_FORMAT0 " %8d %8d %6d %6d" " %5" ZINT_FORMAT0 "\n", b->round, yaz_timing_get_real(tim_dict) + yaz_timing_get_real(tim_isamb), @@ -306,7 +309,7 @@ void index_wrbuf(struct index_block *b, WRBUF wrbuf, zint docid, { /* continuation line */ for (i = 0; i<4 && *cp; i++, cp++) ; - } + } } nl = 0; if (*cp == '\n') @@ -347,7 +350,7 @@ void index_wrbuf(struct index_block *b, WRBUF wrbuf, zint docid, sz++; } cp++; - } + } } if (sz) index_term(b, term, docid, &seqno); @@ -447,7 +450,7 @@ void index_marc_from_file(ISAMB isb, long off = ftell(inf) - 5; if (verbose || print_offset) printf("\n", + "%ld (0x%lx) -->\n", *buf & 0xff, *buf & 0xff, off, off); for (i = 0; i<4; i++) @@ -475,7 +478,7 @@ void index_marc_from_file(ISAMB isb, if (r < rlen) break; yaz_marc_read_iso2709(mt, buf, len); - + if (yaz_marc_write_line(mt, wrbuf)) break; @@ -540,7 +543,7 @@ int main(int argc, char **argv) } break; case 'c': - if (sscanf(arg, "%d:%d", &dict_cache_size, &isam_cache_size) + if (sscanf(arg, "%d:%d", &dict_cache_size, &isam_cache_size) != 2) { fprintf(stderr, "bad cache sizes for -c\n"); @@ -558,7 +561,7 @@ int main(int argc, char **argv) exit_usage(); } } - + if (fname) { inf = fopen(fname, "rb"); @@ -618,7 +621,7 @@ int main(int argc, char **argv) } if (!strcmp(type, "iso2709")) - index_marc_from_file(isb_postings, dict, &docid_seq, inf, memory, + index_marc_from_file(isb_postings, dict, &docid_seq, inf, memory, 0 /* verbose */ , 0 /* print_offset */); else if (!strcmp(type, "line")) index_marc_line_records(isb_postings, dict, &docid_seq, inf, memory); @@ -639,7 +642,7 @@ int main(int argc, char **argv) yaz_timing_get_real(tim), yaz_timing_get_user(tim), yaz_timing_get_sys(tim)); - + yaz_timing_destroy(&tim); exit(0);