aee03471209c972293d191cad1fbc01a96d8206e
2 #include <lttv/traceset.h>
5 /* A trace is a sequence of events gathered in the same tracing session. The
6 events may be stored in several tracefiles in the same directory.
7 A trace set is defined when several traces are to be analyzed together,
8 possibly to study the interactions between events in the different traces.
11 struct _LttvTraceset
{
14 GPtrArray
*attributes
;
19 LttvTraceset
*lttv_traceset_new()
23 s
= g_new(LttvTraceset
, 1);
25 s
->traces
= g_ptr_array_new();
26 s
->attributes
= g_ptr_array_new();
27 s
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
31 LttvTraceset
*lttv_traceset_copy(LttvTraceset
*s_orig
)
36 s
= g_new(LttvTraceset
, 1);
38 s
->traces
= g_ptr_array_new();
39 for(i
=0;i
<s_orig
->traces
->len
;i
++)
43 ltt_trace_copy(g_ptr_array_index(s_orig
->traces
, i
)));
45 s
->attributes
= g_ptr_array_new();
46 for(i
=0;i
<s_orig
->attributes
->len
;i
++)
50 lttv_iattribute_deep_copy(g_ptr_array_index(s_orig
->attributes
, i
)));
53 s
->a
= LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig
->a
)));
58 LttvTraceset
*lttv_traceset_load(const gchar
*filename
)
60 LttvTraceset
*s
= g_new(LttvTraceset
,1);
63 s
->filename
= g_strdup(filename
);
64 tf
= fopen(filename
,"r");
66 g_critical("NOT IMPLEMENTED : load traceset data from a XML file");
72 gint
lttv_traceset_save(LttvTraceset
*s
)
76 tf
= fopen(s
->filename
, "w");
78 g_critical("NOT IMPLEMENTED : save traceset data in a XML file");
83 void lttv_traceset_destroy(LttvTraceset
*s
)
87 for(i
= 0 ; i
< s
->attributes
->len
; i
++) {
88 g_object_unref((LttvAttribute
*)s
->attributes
->pdata
[i
]);
90 g_ptr_array_free(s
->attributes
, TRUE
);
91 g_ptr_array_free(s
->traces
, TRUE
);
96 void lttv_traceset_add(LttvTraceset
*s
, LttTrace
*t
)
98 g_ptr_array_add(s
->traces
, t
);
99 g_ptr_array_add(s
->attributes
, g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
));
103 unsigned lttv_traceset_number(LttvTraceset
*s
)
105 return s
->traces
->len
;
109 LttTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
)
111 g_assert(s
->traces
->len
> i
);
112 return ((LttTrace
*)s
->traces
->pdata
[i
]);
116 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
)
118 g_ptr_array_remove_index(s
->traces
, i
);
119 g_object_unref(s
->attributes
->pdata
[i
]);
120 g_ptr_array_remove_index(s
->attributes
,i
);
124 /* A set of attributes is attached to each trace set, trace and tracefile
125 to store user defined data as needed. */
127 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
)
133 LttvAttribute
*lttv_traceset_trace_attribute(LttvTraceset
*s
, unsigned i
)
135 return (LttvAttribute
*)s
->attributes
->pdata
[i
];
This page took 0.031523 seconds and 3 git commands to generate.