Partial port to WIN95/NT.
[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.4  1997-09-09 13:38:08  adam
8  * Partial port to WIN95/NT.
9  *
10  * Revision 1.3  1996/06/04 10:19:00  adam
11  * Minor changes - removed include of ctype.h.
12  *
13  * Revision 1.2  1996/05/14  14:04:34  adam
14  * In zebraidx, the 'stat' command is improved. Statistics about ISAM/DICT
15  * is collected.
16  *
17  * Revision 1.1  1995/12/06  12:41:26  adam
18  * New command 'stat' for the index program.
19  * Filenames can be read from stdin by specifying '-'.
20  * Bug fix/enhancement of the transformation from terms to regular
21  * expressons in the search engine.
22  *
23  */
24 #include <stdio.h>
25 #include <assert.h>
26 #include <string.h>
27 #include <fcntl.h>
28 #ifndef WINDOWS
29 #include <unistd.h>
30 #endif
31 #include "recindxp.h"
32
33 void rec_prstat (void)
34 {
35     Records records = rec_open (0);
36     int i;
37     int total_bytes = 0;
38     
39     logf (LOG_LOG,
40           "Total records                        %8d",
41           records->head.no_records);
42
43     for (i = 0; i< REC_BLOCK_TYPES; i++)
44     {
45         logf (LOG_LOG, "Record blocks of size %d",
46               records->head.block_size[i]);
47         logf (LOG_LOG,
48           " Used/Total/Bytes used            %d/%d/%d",
49               records->head.block_used[i], records->head.block_last[i]-1,
50               records->head.block_used[i] * records->head.block_size[i]);
51         total_bytes +=
52             records->head.block_used[i] * records->head.block_size[i];
53     }
54     logf (LOG_LOG,
55           "Total size of record index in bytes  %8d",
56           records->head.total_bytes);
57     logf (LOG_LOG,
58           "Total size with overhead             %8d", total_bytes);
59     rec_close (&records);
60 }