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> |
7a4bdb54 | 26 | #include <lttv/trace.h> |
dc877563 | 27 | /* A traceset is a set of traces to be analyzed together. */ |
28 | ||
ba576a78 | 29 | typedef struct _LttvTraceset LttvTraceset; |
dc877563 | 30 | |
7a4bdb54 | 31 | typedef struct _LttvTracesetPosition LttvTracesetPosition; |
dc877563 | 32 | |
922581a4 YB |
33 | struct bt_context; |
34 | ||
7a4bdb54 YB |
35 | |
36 | //TODO ybrosseau 2012-05-15 put these struct in the .c to make them opaque | |
37 | struct _LttvTraceset { | |
38 | char * filename; | |
39 | GPtrArray *traces; /* Array of pointers to LttvTrace */ | |
40 | struct bt_context *context; | |
41 | LttvAttribute *a; | |
42 | LttvHooks *event_hooks; | |
43 | struct bt_ctf_iter *iter; | |
115c78c2 | 44 | GPtrArray *state_trace_handle_index; |
7a4bdb54 YB |
45 | }; |
46 | ||
47 | struct _LttvTrace { | |
48 | // Trace id for babeltrace | |
49 | LttvTraceset *traceset; /* container traceset */ | |
50 | gint id; | |
51 | LttvAttribute *a; | |
52 | guint ref_count; | |
53 | LttvTraceState *state; | |
54 | }; | |
55 | ||
56 | /* In babeltrace, the position concept is an iterator. */ | |
57 | struct _LttvTracesetPosition { | |
58 | struct bt_ctf_iter *iter; | |
3d1e7ee5 | 59 | struct bt_iter_pos *bt_pos; |
7a4bdb54 YB |
60 | }; |
61 | ||
dc877563 | 62 | /* Tracesets may be added to, removed from and their content listed. */ |
63 | ||
7a4bdb54 | 64 | LttvTraceset *lttv_traceset_new(void); |
dc877563 | 65 | |
49bf71b5 | 66 | char * lttv_traceset_name(LttvTraceset * s); |
67 | ||
2bc1bcfb | 68 | #ifdef BABEL_CLEANUP |
308711e5 | 69 | LttvTrace *lttv_trace_new(LttTrace *t); |
2bc1bcfb | 70 | #endif |
308711e5 | 71 | |
451aaf27 FD |
72 | void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname); |
73 | ||
f7afe191 | 74 | LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig); |
75 | ||
76 | LttvTraceset *lttv_traceset_load(const gchar *filename); | |
77 | ||
922581a4 YB |
78 | struct bt_context *lttv_traceset_get_context(LttvTraceset *s); |
79 | ||
80 | ||
7a4bdb54 | 81 | |
f7afe191 | 82 | gint lttv_traceset_save(LttvTraceset *s); |
83 | ||
dc877563 | 84 | void lttv_traceset_destroy(LttvTraceset *s); |
85 | ||
308711e5 | 86 | |
87 | void lttv_traceset_add(LttvTraceset *s, LttvTrace *t); | |
dc877563 | 88 | |
2bc1bcfb | 89 | /* |
3685e022 | 90 | * lttv_trace_create : Add all traces recursively to a traceset from a path |
2bc1bcfb | 91 | * |
451aaf27 | 92 | * |
2bc1bcfb | 93 | * ts is the traceset in which will be contained the traces |
94 | * | |
3685e022 | 95 | * trace_path is the path where to find a set of trace. |
96 | * Traverse the path recursively to add all traces within. | |
2bc1bcfb | 97 | * |
3685e022 | 98 | * return 0 on success or a negative integer on failure |
2bc1bcfb | 99 | */ |
3685e022 | 100 | int lttv_traceset_add_path(LttvTraceset *ts, char *path); |
2bc1bcfb | 101 | |
dc877563 | 102 | unsigned lttv_traceset_number(LttvTraceset *s); |
103 | ||
308711e5 | 104 | LttvTrace *lttv_traceset_get(LttvTraceset *s, unsigned i); |
dc877563 | 105 | |
106 | void lttv_traceset_remove(LttvTraceset *s, unsigned i); | |
107 | ||
dc877563 | 108 | /* An attributes table is attached to the set and to each trace in the set. */ |
109 | ||
110 | LttvAttribute *lttv_traceset_attribute(LttvTraceset *s); | |
111 | ||
7a4bdb54 YB |
112 | /* Take a position snapshot */ |
113 | LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset); | |
2176f952 | 114 | |
7a4bdb54 YB |
115 | /* Destroy position snapshot */ |
116 | void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos); | |
a43d67ba | 117 | |
7a4bdb54 | 118 | void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos); |
a43d67ba | 119 | |
7a4bdb54 | 120 | guint lttv_traceset_get_cpuid_from_event(LttvEvent *event); |
451aaf27 FD |
121 | /* Returns the minimum timestamp of the traces in the traceset */ |
122 | guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset); | |
123 | /* Returns the maximum timestamp of the traces in the traceset */ | |
124 | guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset); | |
7a4bdb54 YB |
125 | |
126 | const char *lttv_traceset_get_name_from_event(LttvEvent *event); | |
dc877563 | 127 | |
7a4bdb54 | 128 | #endif // TRACESET_H |