quit menu complete
[lttv.git] / ltt / branches / poly / lttv / traceset.c
CommitLineData
dc877563 1
2#include <lttv/traceset.h>
3
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.
8*/
9
10struct _LttvTraceset {
11 GPtrArray *traces;
12 GPtrArray *attributes;
13 LttvAttribute *a;
14};
15
16
d83f6739 17LttvTraceset *lttv_traceset_new()
dc877563 18{
ba576a78 19 LttvTraceset *s;
dc877563 20
21 s = g_new(LttvTraceset, 1);
22 s->traces = g_ptr_array_new();
23 s->attributes = g_ptr_array_new();
ba576a78 24 s->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
d83f6739 25 return s;
dc877563 26}
27
28
ba576a78 29void lttv_traceset_destroy(LttvTraceset *s)
dc877563 30{
31 int i, nb;
32
33 for(i = 0 ; i < s->attributes->len ; i++) {
ba576a78 34 g_object_unref((LttvAttribute *)s->attributes->pdata[i]);
dc877563 35 }
ba576a78 36 g_ptr_array_free(s->attributes, TRUE);
37 g_ptr_array_free(s->traces, TRUE);
38 g_object_unref(s->a);
39 g_free(s);
dc877563 40}
41
42
43void lttv_traceset_add(LttvTraceset *s, LttTrace *t)
44{
45 g_ptr_array_add(s->traces, t);
ba576a78 46 g_ptr_array_add(s->attributes, g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
dc877563 47}
48
49
50unsigned lttv_traceset_number(LttvTraceset *s)
51{
ba576a78 52 return s->traces->len;
dc877563 53}
54
55
56LttTrace *lttv_traceset_get(LttvTraceset *s, unsigned i)
57{
58 g_assert(s->traces->len > i);
ba576a78 59 return ((LttTrace *)s->traces->pdata[i]);
dc877563 60}
61
62
ba576a78 63void lttv_traceset_remove(LttvTraceset *s, unsigned i)
dc877563 64{
ba576a78 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);
dc877563 68}
69
70
71/* A set of attributes is attached to each trace set, trace and tracefile
72 to store user defined data as needed. */
73
74LttvAttribute *lttv_traceset_attribute(LttvTraceset *s)
75{
76 return s->a;
77}
78
79
80LttvAttribute *lttv_traceset_trace_attribute(LttvTraceset *s, unsigned i)
81{
ba576a78 82 return (LttvAttribute *)s->attributes->pdata[i];
dc877563 83}
This page took 0.026314 seconds and 4 git commands to generate.