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 | |
49bf71b5 |
18 | char * ltt_trace_name(LttTrace *t); |
19 | |
290dfc8c |
20 | void ltt_trace_close(LttTrace *t); |
1b82f325 |
21 | |
22 | |
963b5f2d |
23 | LttSystemDescription *ltt_trace_system_description(LttTrace *t); |
1b82f325 |
24 | |
1b82f325 |
25 | |
290dfc8c |
26 | /* Functions to discover the facilities in the trace. Once the number |
27 | of facilities is known, they may be accessed by position. Multiple |
28 | versions of a facility (same name, different checksum) have consecutive |
29 | positions. */ |
1b82f325 |
30 | |
290dfc8c |
31 | unsigned ltt_trace_facility_number(LttTrace *t); |
1b82f325 |
32 | |
290dfc8c |
33 | LttFacility *ltt_trace_facility_get(LttTrace *t, unsigned i); |
1b82f325 |
34 | |
a5dcde2f |
35 | LttFacility * ltt_trace_facility_by_id(LttTrace * trace, unsigned id); |
1b82f325 |
36 | |
290dfc8c |
37 | /* Look for a facility by name. It returns the number of facilities found |
38 | and sets the position argument to the first found. Returning 0, the named |
39 | facility is unknown, returning 1, the named facility is at the specified |
40 | position, returning n, the facilities are from position to |
41 | position + n - 1. */ |
1b82f325 |
42 | |
290dfc8c |
43 | unsigned ltt_trace_facility_find(LttTrace *t, char *name, unsigned *position); |
1b82f325 |
44 | |
45 | |
290dfc8c |
46 | /* Functions to discover all the event types in the trace */ |
1b82f325 |
47 | |
290dfc8c |
48 | unsigned ltt_trace_eventtype_number(LttTrace *t); |
1b82f325 |
49 | |
290dfc8c |
50 | LttEventType *ltt_trace_eventtype_get(LttTrace *t, unsigned i); |
1b82f325 |
51 | |
1b82f325 |
52 | |
290dfc8c |
53 | /* There is one "per cpu" tracefile for each CPU, numbered from 0 to |
54 | the maximum number of CPU in the system. When the number of CPU installed |
55 | is less than the maximum, some positions are unused. There are also a |
56 | number of "control" tracefiles (facilities, interrupts...). */ |
1b82f325 |
57 | |
290dfc8c |
58 | unsigned ltt_trace_control_tracefile_number(LttTrace *t); |
1b82f325 |
59 | |
290dfc8c |
60 | unsigned ltt_trace_per_cpu_tracefile_number(LttTrace *t); |
1b82f325 |
61 | |
1b82f325 |
62 | |
290dfc8c |
63 | /* It is possible to search for the tracefiles by name or by CPU position. |
64 | The index within the tracefiles of the same type is returned if found |
65 | and a negative value otherwise. */ |
1b82f325 |
66 | |
290dfc8c |
67 | int ltt_trace_control_tracefile_find(LttTrace *t, char *name); |
1b82f325 |
68 | |
290dfc8c |
69 | int ltt_trace_per_cpu_tracefile_find(LttTrace *t, unsigned i); |
1b82f325 |
70 | |
1b82f325 |
71 | |
290dfc8c |
72 | /* Get a specific tracefile */ |
1b82f325 |
73 | |
290dfc8c |
74 | LttTracefile *ltt_trace_control_tracefile_get(LttTrace *t, unsigned i); |
1b82f325 |
75 | |
290dfc8c |
76 | LttTracefile *ltt_trace_per_cpu_tracefile_get(LttTrace *t, unsigned i); |
1b82f325 |
77 | |
1b82f325 |
78 | |
487ad181 |
79 | /* Get the start time and end time of the trace */ |
80 | |
81 | void ltt_trace_time_span_get(LttTrace *t, LttTime *start, LttTime *end); |
82 | |
83 | |
290dfc8c |
84 | /* Get the name of a tracefile */ |
1b82f325 |
85 | |
290dfc8c |
86 | char *ltt_tracefile_name(LttTracefile *tf); |
1b82f325 |
87 | |
88 | |
80da81ad |
89 | /* Get the number of blocks in the tracefile */ |
90 | |
91 | unsigned ltt_tracefile_block_number(LttTracefile *tf); |
92 | |
93 | |
1b82f325 |
94 | /* Seek to the first event of the trace with time larger or equal to time */ |
95 | |
290dfc8c |
96 | void ltt_tracefile_seek_time(LttTracefile *t, LttTime time); |
1b82f325 |
97 | |
80da81ad |
98 | /* Seek to the first event with position equal or larger to ep */ |
99 | |
100 | void ltt_tracefile_seek_position(LttTracefile *t, |
101 | LttEventPosition *ep); |
1b82f325 |
102 | |
103 | /* Read the next event */ |
104 | |
290dfc8c |
105 | LttEvent *ltt_tracefile_read(LttTracefile *t); |
1b82f325 |
106 | |
a5dcde2f |
107 | /* open tracefile */ |
108 | |
109 | LttTracefile * ltt_tracefile_open(LttTrace *t, char * tracefile_name); |
110 | |
111 | void ltt_tracefile_open_cpu(LttTrace *t, char * tracefile_name); |
112 | |
113 | void ltt_tracefile_open_control(LttTrace *t, char * control_name); |
114 | |
115 | |
116 | /* obtain the time of an event */ |
117 | |
118 | LttTime getEventTime(LttTracefile * tf); |
119 | |
120 | |
121 | /* get the data type size and endian type of the local machine */ |
122 | |
123 | void getDataEndianType(LttArchSize * size, LttArchEndian * endian); |
124 | |
125 | /* get an integer number */ |
126 | |
127 | int getIntNumber(int size1, void *evD); |
128 | |
129 | |
130 | /* get the node name of the system */ |
131 | |
132 | char * ltt_trace_system_description_node_name (LttSystemDescription * s); |
133 | |
134 | |
135 | /* get the domain name of the system */ |
136 | |
137 | char * ltt_trace_system_description_domain_name (LttSystemDescription * s); |
138 | |
139 | |
140 | /* get the description of the system */ |
141 | |
142 | char * ltt_trace_system_description_description (LttSystemDescription * s); |
143 | |
144 | |
145 | /* get the start time of the trace */ |
146 | |
147 | LttTime ltt_trace_system_description_trace_start_time(LttSystemDescription *s); |
148 | |
1b82f325 |
149 | #endif // TRACE_H |