X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=isamb%2Ftstisamb.c;h=0c328900ca82edfae30bd9191f2669fa186c3609;hp=873d0cfffb1ec16db17c8641b776949f48557b47;hb=c00bfddbf0f3608340d61298acc61dafb167f9b2;hpb=58c0ae56c63692ba8f8856cdbb25a060c1317b77 diff --git a/isamb/tstisamb.c b/isamb/tstisamb.c index 873d0cf..0c32890 100644 --- a/isamb/tstisamb.c +++ b/isamb/tstisamb.c @@ -1,8 +1,5 @@ -/* $Id: tstisamb.c,v 1.25 2006-10-30 16:21:29 adam Exp $ - Copyright (C) 1995-2006 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 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 @@ -20,6 +17,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif +#if HAVE_SYS_TIMES_H +#include +#endif +#if HAVE_SYS_TIME_H +#include +#endif + #include #include #include @@ -27,16 +34,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +static int log_level = 0; + static void log_item(int level, const void *b, const char *txt) { int x; memcpy(&x, b, sizeof(int)); - yaz_log(YLOG_DEBUG, "%s %d", txt, x); + yaz_log(log_level, "%s %d", txt, x); } static void log_pr(const char *txt) { - yaz_log(YLOG_DEBUG, "%s", txt); + yaz_log(log_level, "%s", txt); } int compare_item(const void *a, const void *b) @@ -96,8 +105,8 @@ int code_read(void *vp, char **dst, int *insertMode) ri->val = ri->val + ri->step; *insertMode = ri->insertMode; -#if 1 - yaz_log(YLOG_DEBUG, "%d %5d", ri->insertMode, x); +#if 0 + yaz_log(log_level, "%d %5d", ri->insertMode, x); #endif return 1; } @@ -121,7 +130,7 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - + isamc_p = 0; /* new list */ isamb_merge (isb, &isamc_p , &isamc_i); @@ -140,7 +149,7 @@ void tst_insert(ISAMB isb, int n) nerrs++; } else if (nerrs) - yaz_log(YLOG_LOG, "isamb_pp_read. n=%d Got %d", + yaz_log(log_level, "isamb_pp_read. n=%d Got %d", n, x); ri.val++; @@ -165,7 +174,7 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - + isamb_merge (isb, &isamc_p , &isamc_i); /* delete a number of entries (odd ones) */ @@ -178,7 +187,7 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - + isamb_merge (isb, &isamc_p, &isamc_i); if (isamc_p) @@ -207,13 +216,13 @@ void tst_forward(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - + isamc_p = 0; isamb_merge (isb, &isamc_p, &isamc_i); /* read the entries */ pp = isamb_pp_open (isb, isamc_p, 1); - + for (i = 0; iidx >= ri->max) return 0; - + if (ri->delta[ri->idx] > 0) { ri->level++; @@ -348,7 +357,7 @@ void tst_random(ISAMB isb, int n, int rounds, int max_dups) int i, j; for (i = 0; i