1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 #include <lttv/traceset.h>
23 /* A trace is a sequence of events gathered in the same tracing session. The
24 events may be stored in several tracefiles in the same directory.
25 A trace set is defined when several traces are to be analyzed together,
26 possibly to study the interactions between events in the different traces.
29 struct _LttvTraceset
{
43 LttvTraceset
*lttv_traceset_new()
47 s
= g_new(LttvTraceset
, 1);
49 s
->traces
= g_ptr_array_new();
50 s
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
54 char * lttv_traceset_name(LttvTraceset
* s
)
59 LttvTrace
*lttv_trace_new(LttTrace
*t
)
63 new_trace
= g_new(LttvTrace
, 1);
64 new_trace
->a
= g_object_new(LTTV_ATTRIBUTE_TYPE
, NULL
);
66 new_trace
->ref_count
= 0;
71 LttvTraceset
*lttv_traceset_copy(LttvTraceset
*s_orig
)
77 s
= g_new(LttvTraceset
, 1);
79 s
->traces
= g_ptr_array_new();
80 for(i
=0;i
<s_orig
->traces
->len
;i
++)
82 trace
= g_ptr_array_index(s_orig
->traces
, i
);
85 /*CHECK this used ltt_trace_copy while it may not be needed. Need to
86 define how traces and tracesets are shared */
89 g_ptr_array_index(s_orig
->traces
, i
));
91 s
->a
= LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig
->a
)));
96 LttvTraceset
*lttv_traceset_load(const gchar
*filename
)
98 LttvTraceset
*s
= g_new(LttvTraceset
,1);
101 s
->filename
= g_strdup(filename
);
102 tf
= fopen(filename
,"r");
104 g_critical("NOT IMPLEMENTED : load traceset data from a XML file");
110 gint
lttv_traceset_save(LttvTraceset
*s
)
114 tf
= fopen(s
->filename
, "w");
116 g_critical("NOT IMPLEMENTED : save traceset data in a XML file");
122 void lttv_traceset_destroy(LttvTraceset
*s
)
124 g_ptr_array_free(s
->traces
, TRUE
);
125 g_object_unref(s
->a
);
129 void lttv_trace_destroy(LttvTrace
*t
)
131 g_object_unref(t
->a
);
136 void lttv_traceset_add(LttvTraceset
*s
, LttvTrace
*t
)
139 g_ptr_array_add(s
->traces
, t
);
143 unsigned lttv_traceset_number(LttvTraceset
*s
)
145 return s
->traces
->len
;
149 LttvTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
)
151 g_assert(s
->traces
->len
> i
);
152 return ((LttvTrace
*)s
->traces
->pdata
[i
]);
156 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
)
159 g_assert(s
->traces
->len
> i
);
160 t
= (LttvTrace
*)s
->traces
->pdata
[i
];
162 g_ptr_array_remove_index(s
->traces
, i
);
166 /* A set of attributes is attached to each trace set, trace and tracefile
167 to store user defined data as needed. */
169 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
)
175 LttvAttribute
*lttv_trace_attribute(LttvTrace
*t
)
181 LttTrace
*lttv_trace(LttvTrace
*t
)
186 guint
lttv_trace_get_ref_number(LttvTrace
* t
)
191 guint
lttv_trace_ref(LttvTrace
* t
)
198 guint
lttv_trace_unref(LttvTrace
* t
)
This page took 0.032469 seconds and 4 git commands to generate.