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
{
25 LttvTraceset
*lttv_traceset_new()
29 s
= g_new(LttvTraceset
, 1);
31 s
->traces
= g_ptr_array_new();
32 s
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
36 char * lttv_traceset_name(LttvTraceset
* s
)
41 LttvTrace
*lttv_trace_new(LttTrace
*t
)
45 new_trace
= g_new(LttvTrace
, 1);
46 new_trace
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
48 new_trace
->ref_count
= 0;
53 LttvTraceset
*lttv_traceset_copy(LttvTraceset
*s_orig
)
59 s
= g_new(LttvTraceset
, 1);
61 s
->traces
= g_ptr_array_new();
62 for(i
=0;i
<s_orig
->traces
->len
;i
++)
64 trace
= g_ptr_array_index(s_orig
->traces
, i
);
67 /*CHECK this used ltt_trace_copy while it may not be needed. Need to
68 define how traces and tracesets are shared */
71 g_ptr_array_index(s_orig
->traces
, i
));
73 s
->a
= LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig
->a
)));
78 LttvTraceset
*lttv_traceset_load(const gchar
*filename
)
80 LttvTraceset
*s
= g_new(LttvTraceset
,1);
83 s
->filename
= g_strdup(filename
);
84 tf
= fopen(filename
,"r");
86 g_critical("NOT IMPLEMENTED : load traceset data from a XML file");
92 gint
lttv_traceset_save(LttvTraceset
*s
)
96 tf
= fopen(s
->filename
, "w");
98 g_critical("NOT IMPLEMENTED : save traceset data in a XML file");
104 void lttv_traceset_destroy(LttvTraceset
*s
)
106 g_ptr_array_free(s
->traces
, TRUE
);
107 g_object_unref(s
->a
);
111 void lttv_trace_destroy(LttvTrace
*t
)
113 g_object_unref(t
->a
);
118 void lttv_traceset_add(LttvTraceset
*s
, LttvTrace
*t
)
121 g_ptr_array_add(s
->traces
, t
);
125 unsigned lttv_traceset_number(LttvTraceset
*s
)
127 return s
->traces
->len
;
131 LttvTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
)
133 g_assert(s
->traces
->len
> i
);
134 return ((LttvTrace
*)s
->traces
->pdata
[i
]);
138 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
)
141 g_assert(s
->traces
->len
> i
);
142 t
= (LttvTrace
*)s
->traces
->pdata
[i
];
144 g_ptr_array_remove_index(s
->traces
, i
);
148 /* A set of attributes is attached to each trace set, trace and tracefile
149 to store user defined data as needed. */
151 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
)
157 LttvAttribute
*lttv_trace_attribute(LttvTrace
*t
)
163 LttTrace
*lttv_trace(LttvTrace
*t
)
168 guint
lttv_trace_get_ref_number(LttvTrace
* t
)
This page took 0.031562 seconds and 4 git commands to generate.