Enable support for opening multiple trace
[lttv.git] / lttv / lttv / traceset.h
... / ...
CommitLineData
1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
3 *
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;
7 *
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.
12 *
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,
16 * MA 02111-1307, USA.
17 */
18
19#ifndef TRACESET_H
20#define TRACESET_H
21
22#include <lttv/attribute.h>
23#include <lttv/hook.h>
24#include <lttv/event.h>
25#include <ltt/ltt.h>
26#include <ltt/time.h>
27#include <lttv/trace.h>
28/* A traceset is a set of traces to be analyzed together. */
29
30typedef struct _LttvTraceset LttvTraceset;
31
32typedef struct _LttvTracesetPosition LttvTracesetPosition;
33
34struct bt_context;
35
36
37//TODO ybrosseau 2012-05-15 put these struct in the .c to make them opaque
38struct _LttvTraceset {
39 char * filename;
40 GPtrArray *traces; /* Array of pointers to LttvTrace */
41 struct bt_context *context;
42 LttvAttribute *a;
43 LttvHooks *event_hooks;
44 struct bt_ctf_iter *iter;
45 GPtrArray *state_trace_handle_index;
46 gboolean has_precomputed_states;
47 TimeInterval time_span;
48 char *common_path;
49};
50
51#define TRACE_NAME_SIZE 100
52
53struct _LttvTrace {
54 // Trace id for babeltrace
55 LttvTraceset *traceset; /* container traceset */
56 gint id;
57 LttvAttribute *a;
58 guint ref_count;
59 LttvTraceState *state;
60 char short_name[TRACE_NAME_SIZE];
61 char *full_path;
62};
63
64/* In babeltrace, the position concept is an iterator. */
65struct _LttvTracesetPosition {
66 struct bt_ctf_iter *iter;
67 struct bt_iter_pos *bt_pos;
68 guint64 timestamp;
69 int cpu_id;
70};
71
72/* Tracesets may be added to, removed from and their content listed. */
73
74LttvTraceset *lttv_traceset_new(void);
75
76char * lttv_traceset_name(LttvTraceset * s);
77
78#ifdef BABEL_CLEANUP
79LttvTrace *lttv_trace_new(LttTrace *t);
80#endif
81
82void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname);
83
84LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig);
85
86LttvTraceset *lttv_traceset_load(const gchar *filename);
87
88struct bt_context *lttv_traceset_get_context(LttvTraceset *s);
89
90
91
92gint lttv_traceset_save(LttvTraceset *s);
93
94void lttv_traceset_destroy(LttvTraceset *s);
95
96LttvHooks *lttv_traceset_get_hooks(LttvTraceset *s);
97
98void lttv_traceset_add(LttvTraceset *s, LttvTrace *t);
99
100/*
101 * lttv_trace_create : Add all traces recursively to a traceset from a path
102 *
103 *
104 * ts is the traceset in which will be contained the traces
105 *
106 * trace_path is the path where to find a set of trace.
107 * Traverse the path recursively to add all traces within.
108 *
109 * return 0 on success or a negative integer on failure
110 */
111int lttv_traceset_add_path(LttvTraceset *ts, char *path);
112
113unsigned lttv_traceset_number(LttvTraceset *s);
114
115LttvTrace *lttv_traceset_get(LttvTraceset *s, unsigned i);
116
117void lttv_traceset_remove(LttvTraceset *s, unsigned i);
118
119int lttv_traceset_get_trace_index_from_event(LttvEvent *event);
120
121int lttv_traceset_get_trace_index_from_handle_id(LttvTraceset *ts, int handle_id);
122
123/* An attributes table is attached to the set and to each trace in the set. */
124
125LttvAttribute *lttv_traceset_attribute(LttvTraceset *s);
126
127/* Take a position snapshot */
128LttvTracesetPosition *lttv_traceset_create_current_position(LttvTraceset *traceset);
129
130/* Destroy position snapshot */
131void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos);
132
133void lttv_traceset_seek_to_position(const LttvTracesetPosition *traceset_pos);
134
135guint lttv_traceset_get_cpuid_from_event(LttvEvent *event);
136/* Returns the minimum timestamp of the traces in the traceset */
137guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset);
138/* Returns the maximum timestamp of the traces in the traceset */
139guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset);
140/* Return a TimeInterval from timestamp of the first event to the last event [experimentale]*/
141TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts);
142/* Returns a TimeInterval struct that represents the min and max of the traceset */
143TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset);
144
145const char *lttv_traceset_get_name_from_event(LttvEvent *event);
146
147LttvTracesetPosition *lttv_traceset_create_time_position(LttvTraceset *ts, LttTime timestamp);
148
149guint64 lttv_traceset_position_get_timestamp(const LttvTracesetPosition *pos);
150
151LttTime lttv_traceset_position_get_time(const LttvTracesetPosition *pos);
152
153LttTime lttv_traceset_get_current_time(const LttvTraceset *ts);
154
155int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvTracesetPosition *pos2);
156
157int lttv_traceset_position_time_compare(const LttvTracesetPosition *pos1,
158 const LttvTracesetPosition *pos2);
159
160int lttv_traceset_position_compare_current(const LttvTraceset *ts,
161 const LttvTracesetPosition *pos);
162
163#endif // TRACESET_H
This page took 0.022927 seconds and 4 git commands to generate.