X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fdoc%2Fdeveloper%2Fformat.html;h=b24e0c0a1ad97e125f29671f846a5c839a47ea48;hb=331b4e6ec2141543f1eab26b162420a3dc30cb02;hp=7bb1a123fdb9ecae35e1fd534ffe18fc1d86d72c;hpb=584db1461022b2a0092ebecc1c9b0c54d73dae9d;p=lttv.git diff --git a/ltt/branches/poly/doc/developer/format.html b/ltt/branches/poly/doc/developer/format.html index 7bb1a123..b24e0c0a 100644 --- a/ltt/branches/poly/doc/developer/format.html +++ b/ltt/branches/poly/doc/developer/format.html @@ -1,11 +1,16 @@
-+This document describes the LTTng trace format. It should be used only by +developers who code the LTTng tracer or the traceread LTTV library, as this +library offers all the necessary abstractions on top of the raw trace data.
A trace is contained in a directory tree. To send a trace remotely, @@ -18,21 +23,36 @@ $ tree foo foo/ |-- eventdefs | |-- core.xml -| |-- net.xml -| |-- ipv4.xml -| `-- ide.xml +| |-- fs.xml +| |-- ipc.xml +| |-- kernel.xml +| |-- memory.xml +| |-- network.xml +| |-- process.xml +| |-- s390_kernel.xml +| |-- socket.xml +| |-- timer.xml +| `-- ... |-- info | |-- bookmarks.xml | `-- system.xml |-- control -| |-- facilities -| |-- interrupts -| `-- processes -`-- cpu - |-- 0 - |-- 1 - |-- 2 - `-- 3 +| |-- facilities_0 +| |-- facilities_1 +| |-- facilities_... +| |-- interrupts_0 +| |-- interrupts_1 +| |-- interrupts_... +| |-- modules_0 +| |-- modules_1 +| |-- modules_... +| `-- processes_0 +| `-- processes_1 +| `-- processes_... +|-- cpu_0 +|-- cpu_1 +`-- cpu_... +
@@ -41,25 +61,29 @@ facilities used. The syntax is a simple subset of XML; XML is widely
known and easily parsed or hand edited. Each file contains one or more
-A small number of events are predefined, part of the "builtin" facility, -and are not present there. These "builtin" events include "facility_load", -"block_start", "block_end" and "time_heartbeat". +A small number of events are predefined, part of the "core" facility, +and are not present there. These "core" events include "facility_load", +"facility_unload", "time_heartbeat" and "state_dump_facility_load".
-The cpu directory contains a tracefile for each cpu, numbered from 0, -in .trace format. A uniprocessor thus only contains the file cpu/0. +The root directory contains a tracefile for each cpu, numbered from 0, +in .trace format. A uniprocessor thus only contains the file cpu_0. A multi-processor with some unused (possibly hotplug) CPU slots may have some unused CPU numbers. For instance a 8 way SMP board with 6 CPUs randomly installed may produce tracefiles named 0, 1, 2, 4, 6, 7.
-The files in the control directory also follow the .trace format. -The "facilities" file only contains "builtin" facility_load events +The files in the control directory also follow the .trace format and are also +per cpu. +The "facilities" file only contains "core" facility_load, facility_unload, +time_heartbeat and state_dump_facility_load events and is used to determine the facilities used and the code range assigned to each facility. The other control files contain the initial system state and various subsequent important events, for example process @@ -79,22 +103,131 @@ during trace analysis (statistics, index...).
-Each tracefile is divided into equal size blocks with an uint32 at the block -end giving the offset to the last event in the block. Events are packed -sequentially in the block starting at offset 0 with a "block_start" event -and ending, at the offset stored in the last 4 bytes of the block, with a -block_end event. Both the block_start and block_end events -contain the kernel timestamp (timespec binary structure, -uint32 seconds, uint32 nanoseconds), the cycle counter (uint64 cycles), -and the buffer id (uint64). +Each tracefile is divided into equal size blocks with a header at the beginning +of the block. Events are packed sequentially in the block starting right after +the block header. +
+Each block consists of : +
+block start/end header +trace header +event 1 header +event 1 variable length data +event 2 header +event 2 variable length data +.... +padding ++ +
+The block start/end header + +
+begin + * the beginning of buffer information + uint64 cycle_count + * TSC at the beginning of the buffer + uint64 freq + * frequency of the CPUs at the beginning of the buffer. +end + * the end of buffer information + uint64 cycle_count + * TSC at the beginning of the buffer + uint64 freq + * frequency of the CPUs at the end of the buffer. +uint32 lost_size + * number of bytes of padding at the end of the buffer. +uint32 buf_size + * size of the sub-buffer. ++ + + +
+The trace header + +
+uint32 magic_number + * 0x00D6B7ED, used to check the trace byte order vs host byte order. +uint32 arch_type + * Architecture type of the traced machine. +uint32 arch_variant + * Architecture variant of the traced machine. May be unused on some arch. +uint32 float_word_order + * Byte order of floats and doubles, sometimes different from integer byte + order. Useful only for user space traces. +uint8 arch_size + * Size (in bytes) of the void * on the traced machine. +uint8 major_version + * major version of the trace. +uint8 minor_version + * minor version of the trace. +uint8 flight_recorder + * Is flight recorder mode activated ? If yes, data might be missing + (overwritten) in the trace. +uint8 has_heartbeat + * Does this trace have heartbeat timer event activated ? + Yes (1) -> Event header has 32 bits TSC + No (0) -> Event header has 64 bits TSC +uint8 has_alignment + * Is the information in this trace aligned ? + Yes (1) -> aligned on min(arch size, atomic data size). + No (0) -> data is packed. +uint328 freq_scale + event time is always calculated from : + trace_start_time + ((event_tsc - trace_start_tsc) * (freq / freq_scale)) +uint64 start_freq + * CPUs clock frequency at the beginnig of the trace. +uint64 start_tsc + * TSC at the beginning of the trace. +uint64 start_monotonic + * monotonically increasing time at the beginning of the trace. + (currently not supported) +start_time + * Real time at the beginning of the trace (as given by date, adjusted by NTP) + This is the only time reference with the real world : the rest of the trace + has monotonically increasing time from this point (with TSC difference and + clock frequency). + uint32 seconds + uint32 nanoseconds ++ + +
+Event header + +
+Event headers differs depending on those conditions : does the traced system has +a heartbeat timer ? Is tracing alignment activated ?
-Each event consists in an event type id (uint16 which is the event type id -within the facility + the facility base id), a time delta (uint32 in cycles -or nanoseconds, depending on configuration, since the last time value, in the -block header or in a "time_heartbeat" event) and the event type specific data. -All values are packed in native byte order binary format. +Event header : +
+{ uint32 timestamp + or + uint64 timestamp } + * if has_heartbeat : 32 LSB of the cycle counter at the event record time. + * else : 64 bits complete cycle counter. +uint8 facility_id + * Numerical ID of the facility corresponding to the event. See the facility + tracefile to know which facility ID matches which facility name and + description. +uint8 event_id + * Numerical ID of the event inside the facility. +uint16 event_size + * Size of the variable length data that follows this header. ++ +
+Event header alignment + +
+If trace alignment is activated (has_alignment), the event header is aligned +on the architecture size (void pointer size). In addition, a padding is +automatically added after the event header so the variable length data is +automatically aligned on the architecture size. +
-The facility named "builtin" is always present and contains at least the +The facility named "core" is always present and contains at least the following event types.
@@ -235,18 +368,27 @@ following event types. <struct> <field name="name"><string/></field> <field name="checksum"><uint size=4/></field> - <field name="base_code"><uint size=4/></field> + <field name="id"><uint size=4/></field> + <field name="int_size"><uint size=4/></field> + <field name="long_size"><uint size=4/></field> + <field name="pointer_size"><uint size=4/></field> + <field name="size_t_size"><uint size=4/></field> + <field name="has_alignment"><uint size=4/></field> </struct> </event> -<event name=block_start> - <description>Block start timestamp</description> - <typeref name=block_timestamp/> -</event> - -<event name=block_end> - <description>Block end timestamp</description> - <typeref name=block_timestamp/> +<event name=state_dump_facility_load> + <description>Facility used in the trace</description> + <struct> + <field name="name"><string/></field> + <field name="checksum"><uint size=4/></field> + <field name="id"><uint size=4/></field> + <field name="int_size"><uint size=4/></field> + <field name="long_size"><uint size=4/></field> + <field name="pointer_size"><uint size=4/></field> + <field name="size_t_size"><uint size=4/></field> + <field name="has_alignment"><uint size=4/></field> + </struct> </event> <event name=time_heartbeat> @@ -257,26 +399,14 @@ following event types. <typeref name=timestamp/> </event> -<type name=block_timestamp> - <struct> - <field name=timestamp><typeref name=timestamp></field> - <field name=block_id><uint size=4/></field> - </struct> -</type> - <type name=timestamp> <struct> - <field name=time><typeref name=timespec/></event> + <field name="seconds"><uint size=4/></field> + <field name="nanoseconds"><uint size=4/></field> <field name="cycle_count"><uint size=8/></field> </struct> </event> -<type name=timespec> - <struct> - <field name="seconds"><uint size=4/></field> - <field name="nanoseconds"><uint size=4/></field> - </struct> -</type>