X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fnetwork-live.h;fp=src%2Fnetwork-live.h;h=6228865d7d4bab232841b674efeb0dc363045553;hb=b1acd2b342a35dc6c5a8036fb0280321203e89b7;hp=0000000000000000000000000000000000000000;hpb=a18dc7c24b4ac751c46a96198aebcbb1dcd4cdd6;p=lttngtop.git diff --git a/src/network-live.h b/src/network-live.h new file mode 100644 index 0000000..6228865 --- /dev/null +++ b/src/network-live.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2013 Julien Desfossez + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef _LIVE_H +#define _LIVE_H + +#include +#include +#include +#include "lttng-index.h" + +/* Copied from babeltrace/formats/ctf/events-private.h */ +static inline +uint64_t ctf_get_real_timestamp(struct ctf_stream_definition *stream, + uint64_t timestamp) +{ + uint64_t ts_nsec; + struct ctf_trace *trace = stream->stream_class->trace; + struct trace_collection *tc = trace->parent.collection; + uint64_t tc_offset; + + if (tc->clock_use_offset_avg) + tc_offset = tc->single_clock_offset_avg; + else + tc_offset = trace->parent.single_clock->offset; + + ts_nsec = clock_cycles_to_ns(stream->current_clock, timestamp); + ts_nsec += tc_offset; /* Add offset */ + return ts_nsec; +} + +int list_sessions(void); +int write_index_header(int fd); +int attach_session(int id); +void dump_packet_index(struct lttng_packet_index *index); +int get_next_index(int id, struct packet_index *index); +void ctf_live_packet_seek(struct bt_stream_pos *stream_pos, size_t index, + int whence); +int open_trace(struct bt_context **bt_ctx); +int setup_network_live(char *hostname); + +#endif /* _LIVE_H */