From: Adam Dickmeiss Date: Mon, 16 Mar 1998 10:37:24 +0000 (+0000) Subject: Added more statistics. X-Git-Tag: ZEBRA.1.0~221 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=cd0427111b705e414406e1e262f3772e40c7f662 Added more statistics. --- diff --git a/isamc/isamc-p.h b/isamc/isamc-p.h index 0d4d021..a52e486 100644 --- a/isamc/isamc-p.h +++ b/isamc/isamc-p.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: isamc-p.h,v $ - * Revision 1.4 1996-11-08 11:15:28 adam + * Revision 1.5 1998-03-16 10:37:24 adam + * Added more statistics. + * + * Revision 1.4 1996/11/08 11:15:28 adam * Number of keys in chain are stored in first block and the function * to retrieve this information, isc_pp_num is implemented. * @@ -39,6 +42,13 @@ typedef struct ISAMC_file_s { int no_released; int no_remap; + int no_forward; + int no_backward; + int sum_forward; + int sum_backward; + int no_next; + int no_prev; + int fc_max; int *fc_list; } *ISAMC_file; diff --git a/isamc/isamc.c b/isamc/isamc.c index 44155d2..3e89b32 100644 --- a/isamc/isamc.c +++ b/isamc/isamc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: isamc.c,v $ - * Revision 1.11 1998-03-13 15:30:50 adam + * Revision 1.12 1998-03-16 10:37:24 adam + * Added more statistics. + * + * Revision 1.11 1998/03/13 15:30:50 adam * New functions isc_block_used and isc_block_size. Fixed 'leak' * in isc_alloc_block. * @@ -159,6 +162,12 @@ ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method) is->files[i].no_allocated = 0; is->files[i].no_released = 0; is->files[i].no_remap = 0; + is->files[i].no_forward = 0; + is->files[i].no_backward = 0; + is->files[i].sum_forward = 0; + is->files[i].sum_backward = 0; + is->files[i].no_next = 0; + is->files[i].no_prev = 0; init_fc (is, i); } @@ -185,6 +194,22 @@ int isc_close (ISAMC is) int i; if (is->method->debug) + { + logf (LOG_LOG, "isc: next forw mid-f prev backw mid-b"); + for (i = 0; ino_files; i++) + logf (LOG_LOG, "isc:%8d%8d%8.1f%8d%8d%8.1f", + is->files[i].no_next, + is->files[i].no_forward, + is->files[i].no_forward ? + (double) is->files[i].sum_forward/is->files[i].no_forward + : 0.0, + is->files[i].no_prev, + is->files[i].no_backward, + is->files[i].no_backward ? + (double) is->files[i].sum_backward/is->files[i].no_backward + : 0.0); + } + if (is->method->debug) logf (LOG_LOG, "isc: writes reads skipped alloc released remap"); for (i = 0; ino_files; i++) { @@ -391,10 +416,33 @@ int isc_read_item (ISAMC_PP pp, char **dst) if (pp->offset >= pp->size) { + if (!pp->next) + { + pp->pos = 0; + return 0; /* end of file */ + } + if (pp->next > pp->pos) + { + if (pp->next == pp->pos + 1) + is->files[pp->cat].no_next++; + else + { + is->files[pp->cat].no_forward++; + is->files[pp->cat].sum_forward += pp->next - pp->pos; + } + } + else + { + if (pp->next + 1 == pp->pos) + is->files[pp->cat].no_prev++; + else + { + is->files[pp->cat].no_backward++; + is->files[pp->cat].sum_backward += pp->pos - pp->next; + } + } /* out new block position */ pp->pos = pp->next; - if (!pp->pos) - return 0; /* end of file */ src = pp->buf; /* read block and save 'next' and 'size' entry */ isc_read_block (is, pp->cat, pp->pos, src);