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