Commit | Line | Data |
---|---|---|
9c312311 | 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 | ||
dc877563 | 19 | #ifndef TRACESET_H |
20 | #define TRACESET_H | |
21 | ||
22 | #include <lttv/attribute.h> | |
23 | #include <lttv/hook.h> | |
7a4bdb54 | 24 | #include <lttv/event.h> |
dc877563 | 25 | #include <ltt/ltt.h> |
9aaa78dc | 26 | #include <ltt/time.h> |
7a4bdb54 | 27 | #include <lttv/trace.h> |
dc877563 | 28 | /* A traceset is a set of traces to be analyzed together. */ |
29 | ||
ba576a78 | 30 | typedef struct _LttvTraceset LttvTraceset; |
dc877563 | 31 | |
7a4bdb54 | 32 | typedef struct _LttvTracesetPosition LttvTracesetPosition; |
dc877563 | 33 | |
922581a4 YB |
34 | struct bt_context; |
35 | ||
7a4bdb54 YB |
36 | |
37 | //TODO ybrosseau 2012-05-15 put these struct in the .c to make them opaque | |
38 | struct _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; | |
115c78c2 | 45 | GPtrArray *state_trace_handle_index; |
58b4e4ae | 46 | gboolean has_precomputed_states; |
8924e3e4 | 47 | TimeInterval time_span; |
7a4bdb54 YB |
48 | }; |
49 | ||
50 | struct _LttvTrace { | |
51 | // Trace id for babeltrace | |
52 | LttvTraceset *traceset; /* container traceset */ | |
53 | gint id; | |
54 | LttvAttribute *a; | |
55 | guint ref_count; | |
56 | LttvTraceState *state; | |
57 | }; | |
58 | ||
59 | /* In babeltrace, the position concept is an iterator. */ | |
60 | struct _LttvTracesetPosition { | |
61 | struct bt_ctf_iter *iter; | |
3d1e7ee5 | 62 | struct bt_iter_pos *bt_pos; |
88bf15f0 FD |
63 | guint64 timestamp; |
64 | int cpu_id; | |
7a4bdb54 YB |
65 | }; |
66 | ||
dc877563 | 67 | /* Tracesets may be added to, removed from and their content listed. */ |
68 | ||
7a4bdb54 | 69 | LttvTraceset *lttv_traceset_new(void); |
dc877563 | 70 | |
49bf71b5 | 71 | char * lttv_traceset_name(LttvTraceset * s); |
72 | ||
2bc1bcfb | 73 | #ifdef BABEL_CLEANUP |
308711e5 | 74 | LttvTrace *lttv_trace_new(LttTrace *t); |
2bc1bcfb | 75 | #endif |
308711e5 | 76 | |
451aaf27 FD |
77 | void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname); |
78 | ||
f7afe191 | 79 | LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig); |
80 | ||
81 | LttvTraceset *lttv_traceset_load(const gchar *filename); | |
82 | ||
922581a4 YB |
83 | struct bt_context *lttv_traceset_get_context(LttvTraceset *s); |
84 | ||
85 | ||
7a4bdb54 | 86 | |
f7afe191 | 87 | gint lttv_traceset_save(LttvTraceset *s); |
88 | ||
dc877563 | 89 | void lttv_traceset_destroy(LttvTraceset *s); |
90 | ||
88bf15f0 | 91 | LttvHooks *lttv_traceset_get_hooks(LttvTraceset *s); |
308711e5 | 92 | |
93 | void lttv_traceset_add(LttvTraceset *s, LttvTrace *t); | |
dc877563 | 94 | |
2bc1bcfb | 95 | /* |
3685e022 | 96 | * lttv_trace_create : Add all traces recursively to a traceset from a path |
2bc1bcfb | 97 | * |
451aaf27 | 98 | * |
2bc1bcfb | 99 | * ts is the traceset in which will be contained the traces |
100 | * | |
3685e022 | 101 | * trace_path is the path where to find a set of trace. |
102 | * Traverse the path recursively to add all traces within. | |
2bc1bcfb | 103 | * |
3685e022 | 104 | * return 0 on success or a negative integer on failure |
2bc1bcfb | 105 | */ |
3685e022 | 106 | int lttv_traceset_add_path(LttvTraceset *ts, char *path); |
2bc1bcfb | 107 | |
dc877563 | 108 | unsigned lttv_traceset_number(LttvTraceset *s); |
109 | ||
308711e5 | 110 | LttvTrace *lttv_traceset_get(LttvTraceset *s, unsigned i); |
dc877563 | 111 | |
112 | void lttv_traceset_remove(LttvTraceset *s, unsigned i); | |
113 | ||
dc877563 | 114 | /* An attributes table is attached to the set and to each trace in the set. */ |
115 | ||
116 | LttvAttribute *lttv_traceset_attribute(LttvTraceset *s); | |
117 | ||
7a4bdb54 | 118 | /* Take a position snapshot */ |
68573dd0 | 119 | LttvTracesetPosition *lttv_traceset_create_current_position(LttvTraceset *traceset); |
2176f952 | 120 | |
7a4bdb54 YB |
121 | /* Destroy position snapshot */ |
122 | void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos); | |
a43d67ba | 123 | |
9a366873 | 124 | void lttv_traceset_seek_to_position(const LttvTracesetPosition *traceset_pos); |
a43d67ba | 125 | |
7a4bdb54 | 126 | guint lttv_traceset_get_cpuid_from_event(LttvEvent *event); |
451aaf27 FD |
127 | /* Returns the minimum timestamp of the traces in the traceset */ |
128 | guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset); | |
129 | /* Returns the maximum timestamp of the traces in the traceset */ | |
130 | guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset); | |
9a366873 FD |
131 | /* Return a TimeInterval from timestamp of the first event to the last event [experimentale]*/ |
132 | TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts); | |
9aaa78dc FD |
133 | /* Returns a TimeInterval struct that represents the min and max of the traceset */ |
134 | TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset); | |
7a4bdb54 YB |
135 | |
136 | const char *lttv_traceset_get_name_from_event(LttvEvent *event); | |
dc877563 | 137 | |
9a366873 FD |
138 | LttvTracesetPosition *lttv_traceset_create_time_position(LttvTraceset *ts, LttTime timestamp); |
139 | ||
140 | guint64 lttv_traceset_position_get_timestamp(const LttvTracesetPosition *pos); | |
141 | ||
142 | LttTime lttv_traceset_position_get_time(const LttvTracesetPosition *pos); | |
143 | ||
ff5c41f1 YB |
144 | LttTime lttv_traceset_get_current_time(const LttvTraceset *ts); |
145 | ||
9a366873 FD |
146 | int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvTracesetPosition *pos2); |
147 | ||
ff5c41f1 YB |
148 | int lttv_traceset_position_time_compare(const LttvTracesetPosition *pos1, |
149 | const LttvTracesetPosition *pos2); | |
9a366873 | 150 | |
ff5c41f1 YB |
151 | int lttv_traceset_position_compare_current(const LttvTraceset *ts, |
152 | const LttvTracesetPosition *pos); | |
9a366873 | 153 | |
7a4bdb54 | 154 | #endif // TRACESET_H |