menu entries for tab
[lttv.git] / ltt / branches / poly / lttv / trace.c
CommitLineData
59121f0c 1/* A trace is a sequence of events gathered in the same tracing session. The
2 events may be stored in several tracefiles in the same directory.
3 A trace set is defined when several traces are to be analyzed together,
4 possibly to study the interactions between events in the different traces.
5*/
6
7struct _lttv_trace_set {
8 GPtrArray *traces;
9 lttv_attributes *a;
10};
11
12struct _lttv_trace {
13 GPtrArray *all_cpu;
14 GPtrArray *per_cpu;
15 char *name;
16 lttv_attributes *a;
17};
18
19
20struct _lttv_tracefile {
21 ltt_tracefile *t;
22 lttv_attributes *a;
23};
24
25
26lttv_trace_set *lttv_trace_set_new() {
27 lttv_trace_set s;
28
29 s = g_new(lttv_trace_set, 1);
30 s->traces = g_ptr_array_new();
31 s->a = lttv_attributes_new();
32}
33
34lttv_trace_set *lttv_trace_set_destroy(lttv_trace_set *s) {
35 g_ptr_array_free(s->traces);
36 lttv_attributes_destroy(s->a);
37 return g_free(s);
38}
39
40void lttv_trace_set_add(lttv_trace_set *s, lttv_trace *t) {
41 g_ptr_array_add(s,t);
42}
43
44unsigned lttv_trace_set_number(lttv_trace_set *s) {
45 return s->traces.len;
46}
47
48
49lttv_trace *lttv_trace_set_get(lttv_trace_set *s, unsigned i) {
50 g_assert(s->traces->len <= i);
51 return s->traces.pdata[i];
52}
53
54
55lttv_trace *lttv_trace_set_remove(lttv_trace_set *s, unsigned i) {
56 return g_ptr_array_remove_index(s->traces,i);
57}
58
59
60/* Look at all files in the directory. Open all those with ltt as extension
61 and sort these as per cpu or all cpu. */
62
63lttv_trace *lttv_trace_open(char *pathname) {
64 lttv_trace *t;
65
66 t = g_new(lttv_trace, 1);
67 t->per_cpu = g_ptr_array_new();
68 t->all_cpu = g_ptr_array_new();
69 t->a = lttv_attributes_new();
70 return t;
71}
72
73int lttv_trace_close(lttv_trace *t) {
74
75 g_ptr_array_free(t->per_cpu);
76 g_ptr_array_free(t->all_cpu);
77 lttv_attributes_destroy(t->a);
78 g_free(t);
79 return 0;
80}
81
82char *lttv_trace_name(lttv_trace *t) {
83 return t->name;
84}
85
86
87unsigned int lttv_trace_tracefile_number(lttv_trace *t) {
88 return t->per_cpu->len + t->all_cpu->len;
89}
90
91unsigned int lttv_trace_cpu_number(lttv_trace *t) {
92 /* */
93}
94
95unsigned int lttv_trace_tracefile_number_per_cpu(lttv_trace *t) {
96 return t->per_cpu->len;
97}
98
99unsigned int lttv_trace_tracefile_number_all_cpu(lttv_trace *t) {
100 return t->all_cpu_len;
101}
102
103lttv_tracefile *lttv_trace_tracefile_get_per_cpu(lttv_trace *t, unsigned i) {
104 return t->per_cpu->pdata[i];
105}
106
107lttv_tracefile *lttv_trace_tracefile_get_all_cpu(lttv_trace *t, unsigned i) {
108 return t->all_cpu->pdata[i];
109}
110
111
112/* A set of attributes is attached to each trace set, trace and tracefile
113 to store user defined data as needed. */
114
115lttv_attributes *lttv_trace_set_attributes(lttv_trace_set *s) {
116 return s->a;
117}
118
119lttv_attributes *lttv_trace_attributes(lttv_trace *t) {
120 return t->a;
121}
122
123lttv_attributes *lttv_tracefile_attributes(lttv_tracefile *tf) {
124 return tf->a;
125}
126
127
128ltt_tracefile *lttv_tracefile_ltt_tracefile(lttv_tracefile *tf) {
129 return tf->t;
130}
131
132char *lttv_tracefile_name(lttv_tracefile *tf) {
133 return tf->name;
134}
135
136
This page took 0.026776 seconds and 4 git commands to generate.