963b5f2d |
1 | #ifndef TRACE_H |
2 | #define TRACE_H |
1b82f325 |
3 | |
4 | #include <ltt/ltt.h> |
5 | |
6 | /* A trace is specified as a pathname to the directory containing all the |
290dfc8c |
7 | associated data (control tracefiles, per cpu tracefiles, event |
1b82f325 |
8 | descriptions...). |
9 | |
10 | When a trace is closed, all the associated facilities, types and fields |
11 | are released as well. */ |
12 | |
f7afe191 |
13 | LttTrace *ltt_trace_open(const char *pathname); |
14 | |
15 | /* copy reopens a trace */ |
16 | LttTrace *ltt_trace_copy(LttTrace *self); |
1b82f325 |
17 | |
290dfc8c |
18 | void ltt_trace_close(LttTrace *t); |
1b82f325 |
19 | |
20 | |
290dfc8c |
21 | /* The characteristics of the system on which the trace was obtained |
22 | is described in a LttSystemDescription structure. */ |
1b82f325 |
23 | |
963b5f2d |
24 | struct _LttSystemDescription { |
290dfc8c |
25 | char *description; |
26 | char *node_name; |
963b5f2d |
27 | char *domain_name; |
290dfc8c |
28 | unsigned nb_cpu; |
29 | LttArchSize size; |
30 | LttArchEndian endian; |
31 | char *kernel_name; |
32 | char *kernel_release; |
33 | char *kernel_version; |
34 | char *machine; |
35 | char *processor; |
36 | char *hardware_platform; |
37 | char *operating_system; |
38 | unsigned ltt_major_version; |
39 | unsigned ltt_minor_version; |
40 | unsigned ltt_block_size; |
41 | LttTime trace_start; |
42 | LttTime trace_end; |
963b5f2d |
43 | }; |
1b82f325 |
44 | |
963b5f2d |
45 | LttSystemDescription *ltt_trace_system_description(LttTrace *t); |
1b82f325 |
46 | |
1b82f325 |
47 | |
290dfc8c |
48 | /* Functions to discover the facilities in the trace. Once the number |
49 | of facilities is known, they may be accessed by position. Multiple |
50 | versions of a facility (same name, different checksum) have consecutive |
51 | positions. */ |
1b82f325 |
52 | |
290dfc8c |
53 | unsigned ltt_trace_facility_number(LttTrace *t); |
1b82f325 |
54 | |
290dfc8c |
55 | LttFacility *ltt_trace_facility_get(LttTrace *t, unsigned i); |
1b82f325 |
56 | |
57 | |
290dfc8c |
58 | /* Look for a facility by name. It returns the number of facilities found |
59 | and sets the position argument to the first found. Returning 0, the named |
60 | facility is unknown, returning 1, the named facility is at the specified |
61 | position, returning n, the facilities are from position to |
62 | position + n - 1. */ |
1b82f325 |
63 | |
290dfc8c |
64 | unsigned ltt_trace_facility_find(LttTrace *t, char *name, unsigned *position); |
1b82f325 |
65 | |
66 | |
290dfc8c |
67 | /* Functions to discover all the event types in the trace */ |
1b82f325 |
68 | |
290dfc8c |
69 | unsigned ltt_trace_eventtype_number(LttTrace *t); |
1b82f325 |
70 | |
290dfc8c |
71 | LttEventType *ltt_trace_eventtype_get(LttTrace *t, unsigned i); |
1b82f325 |
72 | |
1b82f325 |
73 | |
290dfc8c |
74 | /* There is one "per cpu" tracefile for each CPU, numbered from 0 to |
75 | the maximum number of CPU in the system. When the number of CPU installed |
76 | is less than the maximum, some positions are unused. There are also a |
77 | number of "control" tracefiles (facilities, interrupts...). */ |
1b82f325 |
78 | |
290dfc8c |
79 | unsigned ltt_trace_control_tracefile_number(LttTrace *t); |
1b82f325 |
80 | |
290dfc8c |
81 | unsigned ltt_trace_per_cpu_tracefile_number(LttTrace *t); |
1b82f325 |
82 | |
1b82f325 |
83 | |
290dfc8c |
84 | /* It is possible to search for the tracefiles by name or by CPU position. |
85 | The index within the tracefiles of the same type is returned if found |
86 | and a negative value otherwise. */ |
1b82f325 |
87 | |
290dfc8c |
88 | int ltt_trace_control_tracefile_find(LttTrace *t, char *name); |
1b82f325 |
89 | |
290dfc8c |
90 | int ltt_trace_per_cpu_tracefile_find(LttTrace *t, unsigned i); |
1b82f325 |
91 | |
1b82f325 |
92 | |
290dfc8c |
93 | /* Get a specific tracefile */ |
1b82f325 |
94 | |
290dfc8c |
95 | LttTracefile *ltt_trace_control_tracefile_get(LttTrace *t, unsigned i); |
1b82f325 |
96 | |
290dfc8c |
97 | LttTracefile *ltt_trace_per_cpu_tracefile_get(LttTrace *t, unsigned i); |
1b82f325 |
98 | |
1b82f325 |
99 | |
487ad181 |
100 | /* Get the start time and end time of the trace */ |
101 | |
102 | void ltt_trace_time_span_get(LttTrace *t, LttTime *start, LttTime *end); |
103 | |
104 | |
290dfc8c |
105 | /* Get the name of a tracefile */ |
1b82f325 |
106 | |
290dfc8c |
107 | char *ltt_tracefile_name(LttTracefile *tf); |
1b82f325 |
108 | |
109 | |
80da81ad |
110 | /* Get the number of blocks in the tracefile */ |
111 | |
112 | unsigned ltt_tracefile_block_number(LttTracefile *tf); |
113 | |
114 | |
1b82f325 |
115 | /* Seek to the first event of the trace with time larger or equal to time */ |
116 | |
290dfc8c |
117 | void ltt_tracefile_seek_time(LttTracefile *t, LttTime time); |
1b82f325 |
118 | |
80da81ad |
119 | /* Seek to the first event with position equal or larger to ep */ |
120 | |
121 | void ltt_tracefile_seek_position(LttTracefile *t, |
122 | LttEventPosition *ep); |
1b82f325 |
123 | |
124 | /* Read the next event */ |
125 | |
290dfc8c |
126 | LttEvent *ltt_tracefile_read(LttTracefile *t); |
1b82f325 |
127 | |
128 | #endif // TRACE_H |