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.
7 struct _lttv_trace_set
{
20 struct _lttv_tracefile
{
26 lttv_trace_set
*lttv_trace_set_new() {
29 s
= g_new(lttv_trace_set
, 1);
30 s
->traces
= g_ptr_array_new();
31 s
->a
= lttv_attributes_new();
34 lttv_trace_set
*lttv_trace_set_destroy(lttv_trace_set
*s
) {
35 g_ptr_array_free(s
->traces
);
36 lttv_attributes_destroy(s
->a
);
40 void lttv_trace_set_add(lttv_trace_set
*s
, lttv_trace
*t
) {
44 unsigned lttv_trace_set_number(lttv_trace_set
*s
) {
49 lttv_trace
*lttv_trace_set_get(lttv_trace_set
*s
, unsigned i
) {
50 g_assert(s
->traces
->len
<= i
);
51 return s
->traces
.pdata
[i
];
55 lttv_trace
*lttv_trace_set_remove(lttv_trace_set
*s
, unsigned i
) {
56 return g_ptr_array_remove_index(s
->traces
,i
);
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. */
63 lttv_trace
*lttv_trace_open(char *pathname
) {
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();
73 int lttv_trace_close(lttv_trace
*t
) {
75 g_ptr_array_free(t
->per_cpu
);
76 g_ptr_array_free(t
->all_cpu
);
77 lttv_attributes_destroy(t
->a
);
82 char *lttv_trace_name(lttv_trace
*t
) {
87 unsigned int lttv_trace_tracefile_number(lttv_trace
*t
) {
88 return t
->per_cpu
->len
+ t
->all_cpu
->len
;
91 unsigned int lttv_trace_cpu_number(lttv_trace
*t
) {
95 unsigned int lttv_trace_tracefile_number_per_cpu(lttv_trace
*t
) {
96 return t
->per_cpu
->len
;
99 unsigned int lttv_trace_tracefile_number_all_cpu(lttv_trace
*t
) {
100 return t
->all_cpu_len
;
103 lttv_tracefile
*lttv_trace_tracefile_get_per_cpu(lttv_trace
*t
, unsigned i
) {
104 return t
->per_cpu
->pdata
[i
];
107 lttv_tracefile
*lttv_trace_tracefile_get_all_cpu(lttv_trace
*t
, unsigned i
) {
108 return t
->all_cpu
->pdata
[i
];
112 /* A set of attributes is attached to each trace set, trace and tracefile
113 to store user defined data as needed. */
115 lttv_attributes
*lttv_trace_set_attributes(lttv_trace_set
*s
) {
119 lttv_attributes
*lttv_trace_attributes(lttv_trace
*t
) {
123 lttv_attributes
*lttv_tracefile_attributes(lttv_tracefile
*tf
) {
128 ltt_tracefile
*lttv_tracefile_ltt_tracefile(lttv_tracefile
*tf
) {
132 char *lttv_tracefile_name(lttv_tracefile
*tf
) {
This page took 0.031207 seconds and 4 git commands to generate.