3015264ac37b99d3b37fdfd20425526aa4bba1d1
[idzebra-moved-to-github.git] / index / recstat.c
1 /*
2  * Copyright (C) 1994-1999, Index Data
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: recstat.c,v $
7  * Revision 1.7  1999-02-02 14:51:06  adam
8  * Updated WIN32 code specific sections. Changed header.
9  *
10  * Revision 1.6  1998/01/12 15:04:08  adam
11  * The test option (-s) only uses read-lock (and not write lock).
12  *
13  * Revision 1.5  1997/09/17 12:19:17  adam
14  * Zebra version corresponds to YAZ version 1.4.
15  * Changed Zebra server so that it doesn't depend on global common_resource.
16  *
17  * Revision 1.4  1997/09/09 13:38:08  adam
18  * Partial port to WIN95/NT.
19  *
20  * Revision 1.3  1996/06/04 10:19:00  adam
21  * Minor changes - removed include of ctype.h.
22  *
23  * Revision 1.2  1996/05/14  14:04:34  adam
24  * In zebraidx, the 'stat' command is improved. Statistics about ISAM/DICT
25  * is collected.
26  *
27  * Revision 1.1  1995/12/06  12:41:26  adam
28  * New command 'stat' for the index program.
29  * Filenames can be read from stdin by specifying '-'.
30  * Bug fix/enhancement of the transformation from terms to regular
31  * expressons in the search engine.
32  *
33  */
34 #include <stdio.h>
35 #include <assert.h>
36 #include <string.h>
37 #include <fcntl.h>
38 #ifndef WIN32
39 #include <unistd.h>
40 #endif
41 #include "recindxp.h"
42
43 void rec_prstat (Records records)
44 {
45     int i;
46     int total_bytes = 0;
47     
48     logf (LOG_LOG,
49           "Total records                        %8d",
50           records->head.no_records);
51
52     for (i = 0; i< REC_BLOCK_TYPES; i++)
53     {
54         logf (LOG_LOG, "Record blocks of size %d",
55               records->head.block_size[i]);
56         logf (LOG_LOG,
57           " Used/Total/Bytes used            %d/%d/%d",
58               records->head.block_used[i], records->head.block_last[i]-1,
59               records->head.block_used[i] * records->head.block_size[i]);
60         total_bytes +=
61             records->head.block_used[i] * records->head.block_size[i];
62     }
63     logf (LOG_LOG,
64           "Total size of record index in bytes  %8d",
65           records->head.total_bytes);
66     logf (LOG_LOG,
67           "Total size with overhead             %8d", total_bytes);
68 }