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