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,
22 #include <lttv/attribute.h>
23 #include <lttv/hook.h>
24 #include <lttv/event.h>
26 #include <lttv/trace.h>
27 /* A traceset is a set of traces to be analyzed together. */
29 typedef struct _LttvTraceset LttvTraceset
;
31 typedef struct _LttvTracesetPosition LttvTracesetPosition
;
36 //TODO ybrosseau 2012-05-15 put these struct in the .c to make them opaque
37 struct _LttvTraceset
{
39 GPtrArray
*traces
; /* Array of pointers to LttvTrace */
40 struct bt_context
*context
;
42 LttvHooks
*event_hooks
;
43 struct bt_ctf_iter
*iter
;
44 LttvTraceState
*tmpState
;
49 // Trace id for babeltrace
50 LttvTraceset
*traceset
; /* container traceset */
54 LttvTraceState
*state
;
57 /* In babeltrace, the position concept is an iterator. */
58 struct _LttvTracesetPosition
{
59 struct bt_ctf_iter
*iter
;
62 /* Tracesets may be added to, removed from and their content listed. */
64 LttvTraceset
*lttv_traceset_new(void);
66 char * lttv_traceset_name(LttvTraceset
* s
);
69 LttvTrace
*lttv_trace_new(LttTrace
*t
);
72 LttvTraceset
*lttv_traceset_copy(LttvTraceset
*s_orig
);
74 LttvTraceset
*lttv_traceset_load(const gchar
*filename
);
76 struct bt_context
*lttv_traceset_get_context(LttvTraceset
*s
);
80 gint
lttv_traceset_save(LttvTraceset
*s
);
82 void lttv_traceset_destroy(LttvTraceset
*s
);
85 void lttv_traceset_add(LttvTraceset
*s
, LttvTrace
*t
);
88 * lttv_traceset_add_path : Add all traces recursively to a traceset
90 * ts is the traceset in which will be contained the traces
92 * path is a path to a trace(s). It cannot be NULL and it is not parse
94 * todo mdenis: implement algorithm to go through all folders recursively to
95 * find all traces in the path
97 * @return 0 on success, -1 on failure
99 int lttv_traceset_add_path(LttvTraceset
*ts
, const char *path
);
101 unsigned lttv_traceset_number(LttvTraceset
*s
);
103 LttvTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
);
105 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
);
107 /* An attributes table is attached to the set and to each trace in the set. */
109 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
);
113 LttTrace
*lttv_trace(LttvTrace
*t
);
116 /* Take a position snapshot */
117 LttvTracesetPosition
*lttv_traceset_create_position(LttvTraceset
*traceset
);
119 /* Destroy position snapshot */
120 void lttv_traceset_destroy_position(LttvTracesetPosition
*traceset_pos
);
122 void lttv_traceset_seek_to_position(LttvTracesetPosition
*traceset_pos
);
124 guint
lttv_traceset_get_cpuid_from_event(LttvEvent
*event
);
126 const char *lttv_traceset_get_name_from_event(LttvEvent
*event
);