Logfile
The Logfile
controls the how the simulation log is written to a file. This page explains
- how loggers can write records to a logfile, in case you implement a new logger
- the format of the logfile, in case you want to read it into some other program
See using logging for how to set up the logfile
(e.g. give user-friendly names to the simulation objects). See analysing logs for
R routines to read logs.
Writing records to a logfile
writeRecord(uint32_t type, uint32_t id, uint32_t ev, double val1, double val2, double val3);
Logfile format
The log file consts of two parts: a plain-text preamble, and a binary trace.
Preamble
The preamble consists of lines of plain text, separated by \n
, in any order (except for the # TRACE line).
The lines may be one of
object definition | : objname =objid | associates a plain-text name objname
with a numerical object id, as used in the trace
|
comment line | # arbitrary text string | typically used to describe the simulation setup |
special comment line | # numrecords=nnn | specifies the number of records in the trace that follows |
special comment line | # TRACE | after the \n , the binary part of the log file begins. This must be the last line of the preamble. |
Trace
The trace consists of numrecords
records, consisting of the fields
name | type | meaning |
time | double | timestamp [sec] |
eventtype | unsigned 32-bit int | class of event |
objid | unsigned 32-bit int | object id that the event refers to |
eventidX | unsigned 32-bit int | specific event |
val1 | double | event-specific log values |
val2 | double |
val3 | double |
However, for convenience in reading in these fields, they are laid out transposed, i.e. double[numrecords]
followed by
unsigned 32-bit int[numrecords]
etc.
The meanings of these fields are given by logger implementations, except that
eventidX
is 100*eventtype+eventid