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