Declaring Events next up previous contents
Next: Declaring Enumerations Up: Klogger Configuration File Previous: Configuration File Naming   Contents


Declaring Events

Events are declared in a syntax similar to C structs. The basic template is:

event EVENTNAME {
    typeA varname1;
    typeB varname2;
    ...
    typeN varnameX;
}
with the various types known to Klogger listed in Table 1. Note that the usage of strings is highly discouraged since it requires the use of buffer copy functions, dramatically increasing the logging overhead (though strings up to the size of the underlying hardware's cache line are optimized into simple long assignments).


Table 1: The basic types available in a Klogger event, and their C equivalents.
Klogger Type C Type
short short
ushort unsigned short
int int
long long
longlong long long
ushort unsigned short
uint unsigned int
ulong unsigned long
ulonglong unsigned long long
stringN char[N]


In our SCHEDOUT example, the event will thus be defined as:

event SCHEDOUT {
    int pid
}
and will appear in the final text log as:
{
    header => {
            "type"      => "SCHEDOUT",
            "serial"    => "119",
            "timestamp" => "1032071755760",
    },
    "pid"               => "1073",
},

Though extracting the text based log is described in Section 5.2, for now simply note that each event appears as a Perl hash. The hash contains all the fields described in the event definition and a header containing the event type (as text), its serial number in the log and a timestamp taken from the hardware's cycle counter.


next up previous contents
Next: Declaring Enumerations Up: Klogger Configuration File Previous: Configuration File Naming   Contents
Yoav Etsion 2007-09-09