In zebraidx, the 'stat' command is improved. Statistics about ISAM/DICT
[idzebra-moved-to-github.git] / index / recstat.c
1 /*
2  * Copyright (C) 1994-1996, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: recstat.c,v $
7  * Revision 1.2  1996-05-14 14:04:34  adam
8  * In zebraidx, the 'stat' command is improved. Statistics about ISAM/DICT
9  * is collected.
10  *
11  * Revision 1.1  1995/12/06  12:41:26  adam
12  * New command 'stat' for the index program.
13  * Filenames can be read from stdin by specifying '-'.
14  * Bug fix/enhancement of the transformation from terms to regular
15  * expressons in the search engine.
16  *
17  */
18 #include <stdio.h>
19 #include <assert.h>
20 #include <string.h>
21 #include <ctype.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24
25 #include "recindxp.h"
26
27 void rec_prstat (void)
28 {
29     Records records = rec_open (0);
30     int i;
31     int total_bytes = 0;
32     
33     logf (LOG_LOG,
34           "Total records                        %8d",
35           records->head.no_records);
36
37     for (i = 0; i< REC_BLOCK_TYPES; i++)
38     {
39         logf (LOG_LOG, "Record blocks of size %d",
40               records->head.block_size[i]);
41         logf (LOG_LOG,
42           " Used/Total/Bytes used            %d/%d/%d",
43               records->head.block_used[i], records->head.block_last[i]-1,
44               records->head.block_used[i] * records->head.block_size[i]);
45         total_bytes +=
46             records->head.block_used[i] * records->head.block_size[i];
47     }
48     logf (LOG_LOG,
49           "Total size of record index in bytes  %8d",
50           records->head.total_bytes);
51     logf (LOG_LOG,
52           "Total size with overhead             %8d", total_bytes);
53     rec_close (&records);
54 }