975e44c7 |
1 | |
2 | #include <ltt/ltt.h> |
3 | |
4 | /* A tracefile is specified as a pathname. Facilities must be added to the |
5 | tracefile to declare the type of the contained events. |
6 | |
7 | The ltt_tracefile_facility_add call increases the facility |
8 | usage count and also specifies the base of the numeric range |
9 | assigned to the event types in the facility for this tracefile. |
10 | This information is normally obtained through "facility used" events |
11 | stored in the tracefile. |
12 | |
13 | When a tracefile is closed, all the associated facilities may be |
14 | automatically closed as well, if their usage count is 0, when the |
15 | close_facilities argument is true. */ |
16 | |
17 | ltt_tracefile *ltt_tracefile_open(char *pathname); |
18 | |
19 | int ltt_tracefile_close(ltt_tracefile *t, bool close_facilities); |
20 | |
21 | int ltt_tracefile_facility_add(ltt_tracefile *t, ltt_facility *f, int base_id); |
22 | |
23 | |
24 | /* A tracefile may be queried for its architecture type (e.g., "i386", |
25 | "powerpc", "powerpcle", "s390", "s390x"), its architecture variant |
26 | (e.g., "att" versus "sun" for m68k), its operating system (e.g., "linux", |
27 | "bsd"), its generic architecture, and the machine identity (e.g., system |
28 | host name). All character strings belong to the associated tracefile |
29 | and are freed when it is closed. */ |
30 | |
31 | typedef enum _ltt_arch_size |
32 | { LTT_LP32, LTT_ILP32, LTT_LP64, LTT_ILP64 |
33 | } ltt_arch_size; |
34 | |
35 | typedef enum _ltt_arch_endian |
36 | { LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN |
37 | } ltt_arch_endian; |
38 | |
39 | char *ltt_tracefile_arch_type(ltt_tracefile *t); |
40 | |
41 | char *ltt_tracefile_arch_variant(ltt_tracefile *t); |
42 | |
43 | ltt_arch_size *ltt_tracefile_arch_size(ltt_tracefile *t); |
44 | |
45 | ltt_arch_endian *ltt_tracefile_arch_endian(ltt_tracefile *t); |
46 | |
47 | char *ltt_tracefile_system_type(ltt_tracefile *t); |
48 | |
49 | char *ltt_tracefile_system_name(ltt_tracefile *t); |
50 | |
51 | |
52 | /* SMP multi-processors have 2 or more CPUs */ |
53 | |
54 | unsigned ltt_tracefile_cpu_number(ltt_tracefile *t); |
55 | |
56 | |
57 | /* Does the tracefile contain events only for a single CPU? */ |
58 | |
59 | bool ltt_tracefile_cpu_single(ltt_tracefile *t); |
60 | |
61 | |
62 | /* It this is the case, which CPU? */ |
63 | |
64 | unsigned ltt_tracefile_cpu_id(ltt_tracefile *t); |
65 | |
66 | |
67 | /* Start and end time of the trace and its duration */ |
68 | |
69 | ltt_time ltt_tracefile_time_start(ltt_tracefile *t); |
70 | |
71 | ltt_time ltt_tracefile_time_end(ltt_tracefile *t); |
72 | |
73 | ltt_time ltt_tracefile_duration(ltt_tracefile *t); |
74 | |
75 | |
76 | /* Functions to discover the facilities added to the tracefile */ |
77 | |
78 | unsigned ltt_tracefile_facility_number(ltt_tracefile *t); |
79 | |
80 | ltt_facility *ltt_tracefile_facility_get(ltt_tracefile *t, unsigned i); |
81 | |
82 | ltt_facility *ltt_tracefile_facility_get_by_name(ltt_tracefile *t, char *name); |
83 | |
84 | |
85 | /* Functions to discover all the event types in the facilities added to the |
86 | tracefile. The event type integer id, unique for the trace, is used. */ |
87 | |
88 | unsigned ltt_tracefile_eventtype_number(ltt_tracefile *t); |
89 | |
90 | ltt_eventtype *ltt_tracefile_eventtype_get(ltt_tracefile *t, unsigned i); |
91 | |
92 | |
93 | /* Given an event type, find its unique id within the tracefile */ |
94 | |
95 | unsigned ltt_tracefile_eventtype_id(ltt_tracefile *t, ltt_eventtype *et); |
96 | |
97 | |
98 | /* Get the root field associated with an event type for the tracefile */ |
99 | |
100 | ltt_field *ltt_tracefile_eventtype_root_field(ltt_tracefile *t, unsigned id); |
101 | |
102 | |
103 | /* Seek to the first event of the trace with time larger or equal to time */ |
104 | |
105 | int ltt_tracefile_seek_time(ltt_tracefile *t, ltt_time time); |
106 | |
107 | |
108 | /* Read the next event */ |
109 | |
110 | ltt_event *ltt_tracefile_read(ltt_tracefile *t); |