Track the block statistics. More...
#include <BlockStats.h>
Public Member Functions | |
BlockStats (const char *fileName, int memSize, const char *listStatsFile=0, const char *elementStatsFile=0) | |
void | incrementRuns (void) |
Increment the number of runs stored while indexing (during the gather stage). | |
void | incrementTriples (void) |
Increment the number of triples stored while indexing. | |
void | checkBlockSize (void) |
Reduce the block size to fit in available memory. | |
int | blockSize (void) |
Returns the current block size. | |
int | memorySize (void) |
Returns the set memory size. | |
bool | memoryFull (void) |
Test if the memory is full based on the current Triple count. Returns true if full. | |
void | memoryReset (void) |
Set the recorded number of Triples to zero. | |
int | runCount (void) |
Returns the number of runs processed. | |
char * | fileName (void) |
Returns associated index file name. | |
char * | listStatsFile (void) |
Returns associated list statisitics file name. | |
char * | elementStatsFile (void) |
Returns associated element statisitics file name. |
Track the block statistics.
BlockStats is used to track and accumulate the statistics of the current block sizes and memory usage while gathering the index terms and documents. A block is the unit of memory used when reading and writing to files.
BlockStats::BlockStats | ( | const char * | fileName, | |
int | memSize, | |||
const char * | listStatsFile = 0 , |
|||
const char * | elementStatsFile = 0 | |||
) |
Initialise the block statistics with the allowed memory usage (memSize), the index in use (fileName), and the optional statistics file of the lists (e.g. word.stats) and the optional element statistics file (e.g. document.stats).
void BlockStats::checkBlockSize | ( | void | ) |
Reduce the block size to fit in available memory.
During the merging stage of indexing, there needs to be a block from each run copied into the memory. This function checks if this is possible based on the current number of runs and the memory size. If it is not possible, the block size is reduced until it is possible.