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