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>
27 #include <lttv/trace.h>
28 /* A traceset is a set of traces to be analyzed together. */
30 typedef struct _LttvTraceset LttvTraceset
;
32 typedef struct _LttvTracesetPosition LttvTracesetPosition
;
37 //TODO ybrosseau 2012-05-15 put these struct in the .c to make them opaque
38 struct _LttvTraceset
{
40 GPtrArray
*traces
; /* Array of pointers to LttvTrace */
41 struct bt_context
*context
;
43 LttvHooks
*event_hooks
;
44 struct bt_ctf_iter
*iter
;
45 GPtrArray
*state_trace_handle_index
;
46 gboolean has_precomputed_states
;
50 // Trace id for babeltrace
51 LttvTraceset
*traceset
; /* container traceset */
55 LttvTraceState
*state
;
58 /* In babeltrace, the position concept is an iterator. */
59 struct _LttvTracesetPosition
{
60 struct bt_ctf_iter
*iter
;
61 struct bt_iter_pos
*bt_pos
;
66 /* Tracesets may be added to, removed from and their content listed. */
68 LttvTraceset
*lttv_traceset_new(void);
70 char * lttv_traceset_name(LttvTraceset
* s
);
73 LttvTrace
*lttv_trace_new(LttTrace
*t
);
76 void get_absolute_pathname(const gchar
*pathname
, gchar
* abs_pathname
);
78 LttvTraceset
*lttv_traceset_copy(LttvTraceset
*s_orig
);
80 LttvTraceset
*lttv_traceset_load(const gchar
*filename
);
82 struct bt_context
*lttv_traceset_get_context(LttvTraceset
*s
);
86 gint
lttv_traceset_save(LttvTraceset
*s
);
88 void lttv_traceset_destroy(LttvTraceset
*s
);
90 LttvHooks
*lttv_traceset_get_hooks(LttvTraceset
*s
);
92 void lttv_traceset_add(LttvTraceset
*s
, LttvTrace
*t
);
95 * lttv_trace_create : Add all traces recursively to a traceset from a path
98 * ts is the traceset in which will be contained the traces
100 * trace_path is the path where to find a set of trace.
101 * Traverse the path recursively to add all traces within.
103 * return 0 on success or a negative integer on failure
105 int lttv_traceset_add_path(LttvTraceset
*ts
, char *path
);
107 unsigned lttv_traceset_number(LttvTraceset
*s
);
109 LttvTrace
*lttv_traceset_get(LttvTraceset
*s
, unsigned i
);
111 void lttv_traceset_remove(LttvTraceset
*s
, unsigned i
);
113 /* An attributes table is attached to the set and to each trace in the set. */
115 LttvAttribute
*lttv_traceset_attribute(LttvTraceset
*s
);
117 /* Take a position snapshot */
118 LttvTracesetPosition
*lttv_traceset_create_current_position(LttvTraceset
*traceset
);
120 /* Destroy position snapshot */
121 void lttv_traceset_destroy_position(LttvTracesetPosition
*traceset_pos
);
123 void lttv_traceset_seek_to_position(const LttvTracesetPosition
*traceset_pos
);
125 guint
lttv_traceset_get_cpuid_from_event(LttvEvent
*event
);
126 /* Returns the minimum timestamp of the traces in the traceset */
127 guint64
lttv_traceset_get_timestamp_begin(LttvTraceset
*traceset
);
128 /* Returns the maximum timestamp of the traces in the traceset */
129 guint64
lttv_traceset_get_timestamp_end(LttvTraceset
*traceset
);
130 /* Return a TimeInterval from timestamp of the first event to the last event [experimentale]*/
131 TimeInterval
lttv_traceset_get_time_span_real(LttvTraceset
*ts
);
132 /* Returns a TimeInterval struct that represents the min and max of the traceset */
133 TimeInterval
lttv_traceset_get_time_span(LttvTraceset
*traceset
);
135 const char *lttv_traceset_get_name_from_event(LttvEvent
*event
);
137 LttvTracesetPosition
*lttv_traceset_create_time_position(LttvTraceset
*ts
, LttTime timestamp
);
139 guint64
lttv_traceset_position_get_timestamp(const LttvTracesetPosition
*pos
);
141 LttTime
lttv_traceset_position_get_time(const LttvTracesetPosition
*pos
);
143 LttTime
lttv_traceset_get_current_time(const LttvTraceset
*ts
);
145 int lttv_traceset_position_compare(const LttvTracesetPosition
*pos1
, const LttvTracesetPosition
*pos2
);
147 int lttv_traceset_position_time_compare(const LttvTracesetPosition
*pos1
,
148 const LttvTracesetPosition
*pos2
);
150 int lttv_traceset_position_compare_current(const LttvTraceset
*ts
,
151 const LttvTracesetPosition
*pos
);