remove hard dependency on lttng dev header files
[lttngtop.git] / src / network-live.h
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 <lib/babeltrace/ctf/ctf-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 #endif /* _LIVE_H */
This page took 0.031883 seconds and 4 git commands to generate.