975e44c7 |
1 | |
2 | #include <ltt/ltt-private.h> |
3 | |
4 | /* A trace is associated with a tracing session run on a single, possibly |
5 | multi-cpu, system. It is defined as a pathname to a directory containing |
6 | all the relevant trace files. All the tracefiles for a trace were |
7 | generated in a single system for the same time period by the same |
8 | trace daemon. They simply contain different events. Typically one file |
9 | contains the important events (process creations and registering tracing |
10 | facilities) for all CPUs, and one file for each CPU contains all the |
11 | events for that CPU. All the tracefiles within the same trace directory |
12 | then use the exact same id numbers for event types. |
13 | |
14 | A tracefile (ltt_tracefile) contains a list of events (ltt_event) sorted |
15 | by time for each CPU; events from different CPUs may be slightly out of |
16 | order, especially using the (possibly drifting) cycle counters as |
17 | time unit. |
18 | |
19 | A facility is a list of event types (ltt_eventtype), declared in a special |
20 | .event file. An associated checksum differentiates different facilities |
21 | which would have the same name but a different content (e.g., different |
22 | versions). |
23 | |
24 | The list of facilities (and associated checksum) used in a tracefile |
25 | must be known in order to properly decode the contained events. An event |
26 | is usually stored in the trace to denote each different "facility used". |
27 | While many facilities may be present when the trace starts, new |
28 | facilities may be introduced later as kernel modules are loaded. |
29 | This is fine as long as the "facility used" event precedes any event |
30 | described in that facility. |
31 | |
32 | Event types (ltt_eventtype) refer to data types (ltt_type) describing |
33 | their content. The data types supported are integer and unsigned integer |
34 | (of various length), enumerations (a special form of unsigned integer), |
35 | floating point (of various length), fixed size arrays, sequence |
36 | (variable sized arrays), structures and null terminated strings. |
37 | The elements of arrays and sequences, and the data members for |
38 | structures, may be of any nested data type (ltt_type). |
39 | |
40 | An ltt_field is a special object to denote a specific, possibly nested, |
41 | field within an event type. Suppose an event type socket_connect is a |
42 | structure containing two data membes, source and destination, of type |
43 | socket_address. Type socket_address contains two unsigned integer |
44 | data members, ip and port. An ltt_field is different from a data type |
45 | structure member since it can denote a specific nested field, like the |
46 | source port, and store associated access information (byte offset within |
47 | the event data). The ltt_field objects are tracefile specific since the |
48 | contained information (byte offsets) may vary with the architecture |
49 | associated to the tracefile. */ |
50 | |
51 | typedef struct _ltt_tracefile ltt_tracefile; |
52 | |
53 | typedef struct _ltt_facility ltt_facility; |
54 | |
55 | typedef struct _ltt_eventtype ltt_eventtype; |
56 | |
57 | typedef struct _ltt_type ltt_type; |
58 | |
59 | typedef struct _ltt_field ltt_field; |
60 | |
61 | typedef struct _ltt_event ltt_event; |
62 | |
63 | |
64 | /* Different types allowed */ |
65 | |
66 | typedef enum _ltt_type_enum |
67 | { LTT_INT, LTT_UINT, LTT_FLOAT, LTT_STRING, LTT_ENUM, LTT_ARRAY, |
68 | LTT_SEQUENCE, LTT_STRUCT |
69 | } ltt_type_enum; |
70 | |
71 | |
72 | /* Checksums are used to differentiate facilities which have the same name |
73 | but differ. */ |
74 | |
75 | typedef unsigned long ltt_checksum; |
76 | |
77 | |
78 | /* Events are usually stored with the easily obtained CPU clock cycle count, |
79 | ltt_cycle_count. This can be converted to the real time value, ltt_time, |
80 | using linear interpolation between regularly sampled values (e.g. a few |
81 | times per second) of the real time clock with their corresponding |
82 | cycle count values. */ |
83 | |
84 | typedef struct timespec ltt_time; |
85 | |
86 | typedef uint64_t ltt_cycle_count; |
87 | |
88 | |
89 | |
90 | |