RACE - Modifications and Extensions to ACE from Ravensburg
The RACE-Reader
For archieving greatest possible reading performance we must
- read blocks with the System-Pagesize (save the amount of systemcalls and don't reposition the Harddisk)
- Avoid copying and memory allocation
We assume symetric to the writing case variable length entries, each entry
begins with to 32-bit-longs (length,type) as described in RACE_Layout_GeneralHeader.h.
The RACE::ReadBuffer
The main idea is to have a big buffer, where we read blocks with the systempagesize. The entries are put in RACE::DataBlocks.
The whole RACE::ReadBuffer is a RACE::DataBlockFactory.
The buffer memory is not copied. For each page is counted how many RACE::DataBlock resides at the page.
When a RACE::DataBlock is allocated or duplicated, the counter increases, and it is released, the counter is decremented.
At the end or if a unfreed page is in the middle of the buffer, the Dumpable may get fragmented - a chain of RACE::DataBlock is returend.
The caller may deside to unfragment the chain by allocating a big DataBlock from a other Factory and copying the content.
A problem arise, if the last few bytes are less than the size of RACE_Layout_GeneralHeader and the end or an unfreed page is reached. We copy this butey to a new page and correct the readposition with lseek(2) - Do you know a better solution ?
We assume (or hope) that the main usage is to read, to work and to release. Thus we hope, that the buffer don't fragment to much.
Note, that the RACE::ReadBuffer corresponds to the RACE_Accumulator on the write site.
The RACE::LogfileReader
It cooresponds to the RACE_Logfile and collects the parts together
The Interpretation
The Interpretation of the Logfile happens in three steps:
- The RACE::ReadBuffer splitts the Logfiles in the entries and returns for each entry a chain of RACE_DataBlocks.
- A subclass of the RACE::Interpreter identfies according the type RACE_Layout_GeneralHeader the RACE_Dumpables. It is application specific, the default-Implementation returns simply RACE_Dumpables.
Here is an oportunity tp defragment the RACE_DataBlocks.
- Finaly, an Semantik-class decide what to do with the Dumpable.
The Semantik-Interface is special for the Application - each method corresponds to an entrytype and thus to RACE_Dumpable-Deriviation.
We have identified the Semantik-Class -Pattern with the Visitor Pattern.
The RACE_Dumpable as a general application-independent class
has an method CallVisitor with an very abstract Interface RACE::DumpableVisitor. The application specific Semantikinterface have to inherit from RACE::DumpableVisitor.
The derivations of RACE_Dumpable implement the CallVisitor. First they have to narrow the application specific Semantic-Interface and then call the corresponding method.
The driver
The driver is nearly application intependent and controlls the reading and interpretation of a logfile.
Computerscience and Networkassocation Ravensburg e.V Rudolf Weber and friends