2 #include <lttv/traceset.h>
4 /* A trace is a sequence of events gathered in the same tracing session. The
5 events may be stored in several tracefiles in the same directory.
6 A trace set is defined when several traces are to be analyzed together,
7 possibly to study the interactions between events in the different traces.
10 struct _LttvTraceset
{
12 GPtrArray
*attributes
;
17 LttvTraceset
*lttv_traceset_new()
21 s
= g_new(LttvTraceset
, 1);
22 s
->traces
= g_ptr_array_new();
23 s
->attributes
= g_ptr_array_new();
24 s
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
29 void lttv_traceset_destroy(LttvTraceset
*s
)
33 for(i
= 0 ; i
< s
->attributes
->len
; i
++) {
34 g_object_unref((LttvAttribute
*)s
->attributes
->pdata
[i
]);
36 g_ptr_array_free(s
->attributes
, TRUE
);
37 g_ptr_array_free(s
->traces
, TRUE
);
43 void lttv_traceset_add(LttvTraceset
*s
, LttTrace
*t
)
45 g_ptr_array_add(s
->traces
, t
);
46 g_ptr_array_add(s
->attributes
, g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
));
50 unsigned lttv_traceset_number(LttvTraceset
*s
)
52 return s
->traces
->len
;
56 LttTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
)
58 g_assert(s
->traces
->len
> i
);
59 return ((LttTrace
*)s
->traces
->pdata
[i
]);
63 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
)
65 g_ptr_array_remove_index(s
->traces
, i
);
66 g_object_unref(s
->attributes
->pdata
[i
]);
67 g_ptr_array_remove_index(s
->attributes
,i
);
71 /* A set of attributes is attached to each trace set, trace and tracefile
72 to store user defined data as needed. */
74 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
)
80 LttvAttribute
*lttv_traceset_trace_attribute(LttvTraceset
*s
, unsigned i
)
82 return (LttvAttribute
*)s
->attributes
->pdata
[i
];
This page took 0.03223 seconds and 4 git commands to generate.