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