Commit | Line | Data |
---|---|---|
b1acd2b3 JD |
1 | /* |
2 | * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com> | |
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 along | |
14 | * with this program; if not, write to the Free Software Foundation, Inc., | |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef _LIVE_H | |
19 | #define _LIVE_H | |
20 | ||
21 | #include <lib/babeltrace/ctf/types.h> | |
22 | #include <lib/babeltrace/ctf-ir/metadata.h> | |
23 | #include <lib/babeltrace/clock-internal.h> | |
24 | #include "lttng-index.h" | |
25 | ||
26 | /* Copied from babeltrace/formats/ctf/events-private.h */ | |
27 | static inline | |
28 | uint64_t ctf_get_real_timestamp(struct ctf_stream_definition *stream, | |
29 | uint64_t timestamp) | |
30 | { | |
31 | uint64_t ts_nsec; | |
32 | struct ctf_trace *trace = stream->stream_class->trace; | |
33 | struct trace_collection *tc = trace->parent.collection; | |
34 | uint64_t tc_offset; | |
35 | ||
36 | if (tc->clock_use_offset_avg) | |
37 | tc_offset = tc->single_clock_offset_avg; | |
38 | else | |
39 | tc_offset = trace->parent.single_clock->offset; | |
40 | ||
41 | ts_nsec = clock_cycles_to_ns(stream->current_clock, timestamp); | |
42 | ts_nsec += tc_offset; /* Add offset */ | |
43 | return ts_nsec; | |
44 | } | |
45 | ||
46 | int list_sessions(void); | |
47 | int write_index_header(int fd); | |
48 | int attach_session(int id); | |
49 | void dump_packet_index(struct lttng_packet_index *index); | |
50 | int get_next_index(int id, struct packet_index *index); | |
51 | void ctf_live_packet_seek(struct bt_stream_pos *stream_pos, size_t index, | |
52 | int whence); | |
53 | int open_trace(struct bt_context **bt_ctx); | |
54 | int setup_network_live(char *hostname); | |
55 | ||
56 | #endif /* _LIVE_H */ |