From: Heikki Levanto Date: Fri, 20 Aug 1999 12:25:58 +0000 (+0000) Subject: Statistics in isamd X-Git-Tag: ZEBRA.1.0~47 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=e001ebdd731ab742f95e185348c67c8ffdde790d;p=idzebra-moved-to-github.git Statistics in isamd --- diff --git a/isamc/isamd-p.h b/isamc/isamd-p.h index 22859e2..aeb0a4c 100644 --- a/isamc/isamd-p.h +++ b/isamc/isamd-p.h @@ -1,4 +1,4 @@ -/* +/* $Id: isamd-p.h,v 1.5 1999-08-20 12:25:58 heikki Exp $ * Copyright (c) 1995-1996, Index Data. * See the file LICENSE for details. * Heikki Levanto @@ -39,6 +39,14 @@ typedef struct ISAMD_file_s { int no_next; int no_prev; + int no_op_nodiff; /* existing blocks opened for reading without diffs */ + int no_op_intdiff; /* - with internal diffs */ + int no_op_extdiff; /* with separate diff blocks */ + int no_fbuilds; /* number of first-time builds */ + int no_appds; /* number of appends */ + int no_merges; /* number of merges done */ + int no_remerges; /* number of times more than one merge needed */ + char *alloc_buf; /* free-list handling (?) */ int alloc_entries_num; int alloc_entries_max; @@ -96,7 +104,10 @@ void isamd_free_diffs(ISAMD_PP pp); /* * $Log: isamd-p.h,v $ - * Revision 1.4 1999-07-21 14:24:50 heikki + * Revision 1.5 1999-08-20 12:25:58 heikki + * Statistics in isamd + * + * Revision 1.4 1999/07/21 14:24:50 heikki * isamd write and read functions ok, except when diff block full. * (merge not yet done) * diff --git a/isamc/isamd.c b/isamc/isamd.c index 3052990..d744414 100644 --- a/isamc/isamd.c +++ b/isamc/isamd.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1995-1998, Index Data. * See the file LICENSE for details. - * $Id: isamd.c,v 1.8 1999-08-18 13:28:16 heikki Exp $ + * $Id: isamd.c,v 1.9 1999-08-20 12:25:58 heikki Exp $ * * Isamd - isam with diffs * Programmed by: Heikki Levanto @@ -136,6 +136,13 @@ ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method) is->files[i].sum_backward = 0; is->files[i].no_next = 0; is->files[i].no_prev = 0; + is->files[i].no_op_nodiff=0; + is->files[i].no_op_intdiff=0; + is->files[i].no_op_extdiff=0; + is->files[i].no_fbuilds=0; + is->files[i].no_appds=0; + is->files[i].no_merges=0; + is->files[i].no_remerges=0; init_fc (is, i); } @@ -163,9 +170,10 @@ int isamd_close (ISAMD is) if (is->method->debug>0) { - logf (LOG_LOG, "isamd: next forw mid-f prev backw mid-b"); + logf (LOG_LOG, "isamd statistics"); + logf (LOG_LOG, "f nxt forw mid-f prev backw mid-b"); for (i = 0; ino_files; i++) - logf (LOG_LOG, "isamd:%8d%8d%8.1f%8d%8d%8.1f", + logf (LOG_LOG, "%d%8d%8d%8.1f%8d%8d%8.1f",i, is->files[i].no_next, is->files[i].no_forward, is->files[i].no_forward ? @@ -178,7 +186,7 @@ int isamd_close (ISAMD is) : 0.0); } if (is->method->debug>0) - logf (LOG_LOG, "isamd: writes reads skipped alloc released remap"); + logf (LOG_LOG, "f writes reads skipped alloc released "); for (i = 0; ino_files; i++) { release_fc (is, i); @@ -187,17 +195,37 @@ int isamd_close (ISAMD is) bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head), &is->files[i].head); if (is->method->debug>0) - logf (LOG_LOG, "isamd:%8d%8d%8d%8d%8d%8d", + logf (LOG_LOG, "%d%8d%8d%8d%8d%8d",i, is->files[i].no_writes, is->files[i].no_reads, is->files[i].no_skip_writes, is->files[i].no_allocated, - is->files[i].no_released, - is->files[i].no_remap); + is->files[i].no_released); xfree (is->files[i].fc_list); flush_block (is, i); bf_close (is->files[i].bf); } + + if (is->method->debug>0) + { + logf (LOG_LOG, "f opens simple int ext"); + for (i = 0; ino_files; i++) + { + logf (LOG_LOG, "%d%8d%8d%8d%8d",i, + is->files[i].no_op_nodiff+ + is->files[i].no_op_intdiff+ + is->files[i].no_op_extdiff, + is->files[i].no_op_nodiff, + is->files[i].no_op_intdiff, + is->files[i].no_op_extdiff); + } + logf (LOG_LOG, " build append merge remrg"); + logf (LOG_LOG, "=%8d%8d%8d%8d", + is->files[0].no_fbuilds, + is->files[0].no_appds, + is->files[0].no_merges, + is->files[0].no_remerges); + } xfree (is->files); xfree (is->method); xfree (is); @@ -485,6 +513,13 @@ ISAMD_PP isamd_pp_open (ISAMD is, ISAMD_P ipos) assert (pp->next != pp->pos); pp->offset = src - pp->buf; assert (pp->offset == ISAMD_BLOCK_OFFSET_1); + if (0==pp->diffs) + ++(is->files[pp->cat].no_op_nodiff); + else + if(pp->diffs&1) + ++(is->files[pp->cat].no_op_extdiff); + else + ++(is->files[pp->cat].no_op_intdiff); } if (is->method->debug > 5) logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d", @@ -682,7 +717,10 @@ void isamd_pp_dump (ISAMD is, ISAMD_P ipos) /* * $Log: isamd.c,v $ - * Revision 1.8 1999-08-18 13:28:16 heikki + * Revision 1.9 1999-08-20 12:25:58 heikki + * Statistics in isamd + * + * Revision 1.8 1999/08/18 13:28:16 heikki * Set log levels to decent values * * Revision 1.6 1999/08/17 19:44:25 heikki diff --git a/isamc/merge-d.c b/isamc/merge-d.c index 8c41ebd..b027f7a 100644 --- a/isamc/merge-d.c +++ b/isamc/merge-d.c @@ -3,17 +3,18 @@ * See the file LICENSE for details. * Heikki Levanto * - * $Id: merge-d.c,v 1.13 1999-08-18 13:59:19 heikki Exp $ + * $Id: merge-d.c,v 1.14 1999-08-20 12:25:58 heikki Exp $ * * todo - * - Clean up log levels * - Input filter: Eliminate del-ins pairs, tell if only one entry (or none) - * - single-entry optimizing + * - single-entry optimizing (keep the one entry in the dict, no block) * - study and optimize block sizes (later) * - Clean up the different ways diffs are handled in writing and reading * - Keep a merge-count in the firstpp, and if the block has already been * merged, reduce it to a larger size even if it could fit in a small one! * - Keep minimum freespace in the category table, and use that in reduce! + * - pass a space-needed for separateDiffBlock and reduce to be able to + * reserve more room for diffs, or to force a separate (larger?) block * * bugs * - Still has not been able to run a complete long test on bagel! @@ -43,7 +44,7 @@ * 7 = Log each record as it passes the system (once) * 8 = Log raw and (de)coded data * 9 = Anything else that may be useful - * .. = Anything needed toi hunt a specific bug + * .. = Anything needed to hunt a specific bug * (note that all tests in the code are like debug>3, which means 4 or above!) */ @@ -572,6 +573,8 @@ static int isamd_build_first_block(ISAMD is, ISAMD_I data) char hexbuff[64]; + ++(is->files[0].no_fbuilds); + firstpp=pp=isamd_pp_open(is, isamd_addr(0,is->max_cat)); firstpp->size = firstpp->offset = ISAMD_BLOCK_OFFSET_1; @@ -633,6 +636,8 @@ static int merge ( ISAMD_PP *p_firstpp, /* first pp of the chain */ ISAMD_PP firstpp; /* the new first, the one we write into */ ISAMD_PP pp; void *encoder_data; + + ++(readpp->is->files[0].no_merges); /* set up diffs as they should be for reading */ readpp->offset= ISAMD_BLOCK_OFFSET_1; @@ -791,6 +796,9 @@ static int append_diffs(ISAMD is, ISAMD_P ipos, ISAMD_I data) char *c_ptr = codebuff; int codelen; int merge_rc; + int mergecount=0; + + ++(is->files[0].no_appds); firstpp=isamd_pp_open(is, ipos); if (is->method->debug >2) @@ -837,6 +845,8 @@ static int append_diffs(ISAMD is, ISAMD_P ipos, ISAMD_I data) logf(LOG_LOG,"isamd_appd: block pp=%p buf=%p [%d]:%s", pp, pp->buf, difflenidx, hexdump(&pp->buf[difflenidx],8,0)); + if (mergecount++) + ++(is->files[0].no_remerges); merge_rc = merge (&firstpp, &pp, &i_key); if (0!=merge_rc) return merge_rc; /* merge handled them all ! */ @@ -932,7 +942,10 @@ ISAMD_P isamd_append (ISAMD is, ISAMD_P ipos, ISAMD_I data) /* * $Log: merge-d.c,v $ - * Revision 1.13 1999-08-18 13:59:19 heikki + * Revision 1.14 1999-08-20 12:25:58 heikki + * Statistics in isamd + * + * Revision 1.13 1999/08/18 13:59:19 heikki * Fixed another unlikely difflen bug * * Revision 1.12 1999/08/18 13:28:17 heikki