1b82f325 |
1 | #ifndef TRACEFILE_H |
2 | #define TRACEFILE_H |
3 | |
4 | #include <ltt/ltt.h> |
5 | |
6 | /* A trace is specified as a pathname to the directory containing all the |
7 | associated data (control tracefile, per cpu tracefiles, event |
8 | descriptions...). |
9 | |
10 | When a trace is closed, all the associated facilities, types and fields |
11 | are released as well. */ |
12 | |
13 | ltt_trace *ltt_trace_open(char *pathname); |
14 | |
15 | void ltt_trace_close(ltt_trace *t); |
16 | |
17 | |
18 | /* A trace may be queried for its architecture type (e.g., "i386", |
19 | "powerpc", "powerpcle", "s390", "s390x"), its architecture variant |
20 | (e.g., "att" versus "sun" for m68k), its operating system (e.g., "linux", |
21 | "bsd"), its generic architecture, and the machine identity (e.g., system |
22 | host name). All character strings belong to the associated tracefile |
23 | and are freed when it is closed. */ |
24 | |
25 | |
26 | char *ltt_tracefile_arch_type(ltt_trace *t); |
27 | |
28 | char *ltt_tracefile_arch_variant(ltt_trace *t); |
29 | |
30 | char *ltt_tracefile_system_type(ltt_trace *t); |
31 | |
32 | ltt_arch_size ltt_tracefile_arch_size(ltt_trace *t); |
33 | |
34 | ltt_arch_endian ltt_tracefile_arch_endian(ltt_trace *t); |
35 | |
36 | |
37 | /* Hostname of the system where the trace was recorded */ |
38 | |
39 | char *ltt_trace_system_name(ltt_tracefile *t); |
40 | |
41 | |
42 | /* SMP multi-processors have 2 or more CPUs */ |
43 | |
44 | unsigned ltt_trace_cpu_number(ltt_trace *t); |
45 | |
46 | |
47 | /* Start and end time of the trace and its duration */ |
48 | |
49 | ltt_time ltt_tracefile_time_start(ltt_trace *t); |
50 | |
51 | ltt_time ltt_tracefile_time_end(ltt_trace *t); |
52 | |
53 | ltt_time ltt_tracefile_duration(ltt_tracefile *t); |
54 | |
55 | |
56 | /* Functions to discover the facilities in the trace */ |
57 | |
58 | unsigned ltt_trace_facility_number(ltt_trace *t); |
59 | |
60 | ltt_facility *ltt_trace_facility_get(ltt_trace *t, unsigned i); |
61 | |
62 | ltt_facility *ltt_trace_facility_get_by_name(ltt_trace *t, char *name); |
63 | |
64 | |
65 | /* Functions to discover all the event types in the trace */ |
66 | |
67 | unsigned ltt_trace_eventtype_number(ltt_tracefile *t); |
68 | |
69 | ltt_eventtype *ltt_trace_eventtype_get(ltt_tracefile *t, unsigned i); |
70 | |
71 | |
72 | /* A trace typically contains one "control" tracefile with important events |
73 | (for all CPUs), and one tracefile with ordinary events per cpu. |
74 | The tracefiles in a trace may be enumerated for each category |
75 | (all cpu and per cpu). The total number of tracefiles and of CPUs |
76 | may also be obtained. */ |
77 | |
78 | unsigned int ltt_trace_tracefile_number(ltt_trace *t); |
79 | |
80 | unsigned int ltt_trace_tracefile_number_per_cpu(ltt_trace *t); |
81 | |
82 | unsigned int ltt_trace_tracefile_number_all_cpu(ltt_trace *t); |
83 | |
84 | ltt_tracefile *ltt_trace_tracefile_get_per_cpu(ltt_trace *t, unsigned i); |
85 | |
86 | ltt_tracefile *ltt_trace_tracefile_get_all_cpu(ltt_trace *t, unsigned i); |
87 | |
88 | char *ltt_tracefile_name(ltt_tracefile *tf); |
89 | |
90 | |
91 | /* Seek to the first event of the trace with time larger or equal to time */ |
92 | |
93 | int ltt_tracefile_seek_time(ltt_tracefile *t, ltt_time time); |
94 | |
95 | |
96 | /* Read the next event */ |
97 | |
98 | ltt_event *ltt_tracefile_read(ltt_tracefile *t); |
99 | |
100 | #endif // TRACE_H |