sync lttng and babeltrace last headers for live
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 30 Jan 2014 03:20:16 +0000 (22:20 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Thu, 30 Jan 2014 03:20:16 +0000 (22:20 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/lttng-index.h [deleted file]
src/lttng-viewer.h
src/lttngtop.c
src/network-live.c
src/network-live.h

diff --git a/src/lttng-index.h b/src/lttng-index.h
deleted file mode 100644 (file)
index d85b0ed..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
- *                      David Goulet <dgoulet@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2 only,
- * 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 LTTNG_INDEX_H
-#define LTTNG_INDEX_H
-
-#include <limits.h>
-
-#define INDEX_MAGIC "CTFIDX"
-#define INDEX_MAJOR 1
-#define INDEX_MINOR 0
-
-/*
- * Header at the beginning of each index file.
- * All integer fields are stored in big endian.
- */
-struct lttng_packet_index_file_hdr {
-       char magic[6];
-       uint32_t index_major;
-       uint32_t index_minor;
-} __attribute__((__packed__));
-
-/*
- * Packet index generated for each trace packet store in a trace file.
- * All integer fields are stored in big endian.
- */
-struct lttng_packet_index {
-       uint64_t offset;                /* offset of the packet in the file, in bytes */
-       uint64_t packet_size;           /* packet size, in bits */
-       uint64_t content_size;          /* content size, in bits */
-       uint64_t timestamp_begin;
-       uint64_t timestamp_end;
-       uint64_t events_discarded;
-       uint64_t stream_id;
-} __attribute__((__packed__));
-
-#endif /* LTTNG_INDEX_H */
index 56fa5632db86b6411dc4f2beb88ae9d55058b1f2..1977a43b460852627bec6b8a6c1444e2da29ad83 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef LTTNG_VIEWER_H
+#define LTTNG_VIEWER_H
+
 /*
  * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
  *                      Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 /*
  * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
  *                      Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
@@ -22,9 +25,6 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#ifndef LTTNG_VIEWER_H
-#define LTTNG_VIEWER_H
-
 #include <limits.h>
 
 #define LTTNG_VIEWER_PATH_MAX          4096
 #include <limits.h>
 
 #define LTTNG_VIEWER_PATH_MAX          4096
@@ -34,7 +34,7 @@
 /* Flags in reply to get_next_index and get_packet. */
 /* New metadata is required to read this packet. */
 #define LTTNG_VIEWER_FLAG_NEW_METADATA (1 << 0)
 /* Flags in reply to get_next_index and get_packet. */
 /* New metadata is required to read this packet. */
 #define LTTNG_VIEWER_FLAG_NEW_METADATA (1 << 0)
-/* New stream got added to the trace */
+/* New stream got added to the trace. */
 #define LTTNG_VIEWER_FLAG_NEW_STREAM   (1 << 1)
 
 enum lttng_viewer_command {
 #define LTTNG_VIEWER_FLAG_NEW_STREAM   (1 << 1)
 
 enum lttng_viewer_command {
@@ -60,12 +60,14 @@ enum lttng_viewer_next_index_return_code {
        VIEWER_INDEX_HUP        = 3, /* Index closed (trace destroyed). */
        VIEWER_INDEX_ERR        = 4, /* Unknow error. */
        VIEWER_INDEX_INACTIVE   = 5, /* Inactive stream beacon. */
        VIEWER_INDEX_HUP        = 3, /* Index closed (trace destroyed). */
        VIEWER_INDEX_ERR        = 4, /* Unknow error. */
        VIEWER_INDEX_INACTIVE   = 5, /* Inactive stream beacon. */
+       VIEWER_INDEX_EOF        = 6, /* End of index file. */
 };
 
 enum lttng_viewer_get_packet_return_code {
        VIEWER_GET_PACKET_OK            = 1,
        VIEWER_GET_PACKET_RETRY         = 2,
        VIEWER_GET_PACKET_ERR           = 3,
 };
 
 enum lttng_viewer_get_packet_return_code {
        VIEWER_GET_PACKET_OK            = 1,
        VIEWER_GET_PACKET_RETRY         = 2,
        VIEWER_GET_PACKET_ERR           = 3,
+       VIEWER_GET_PACKET_EOF           = 4,
 };
 
 enum lttng_viewer_get_metadata_return_code {
 };
 
 enum lttng_viewer_get_metadata_return_code {
@@ -80,24 +82,27 @@ enum lttng_viewer_connection_type {
 };
 
 enum lttng_viewer_seek {
 };
 
 enum lttng_viewer_seek {
-       VIEWER_SEEK_BEGINNING   = 1,    /* Receive the trace packets from the beginning. */
-       VIEWER_SEEK_LAST        = 2,    /* Receive the trace packets from now. */
+       /* Receive the trace packets from the beginning. */
+       VIEWER_SEEK_BEGINNING   = 1,
+       /* Receive the trace packets from now. */
+       VIEWER_SEEK_LAST        = 2,
 };
 
 struct lttng_viewer_session {
        uint64_t id;
 };
 
 struct lttng_viewer_session {
        uint64_t id;
-       char hostname[LTTNG_VIEWER_HOST_NAME_MAX];
-       char session_name[LTTNG_VIEWER_NAME_MAX];
        uint32_t live_timer;
        uint32_t clients;
        uint32_t live_timer;
        uint32_t clients;
+       uint32_t streams;
+       char hostname[LTTNG_VIEWER_HOST_NAME_MAX];
+       char session_name[LTTNG_VIEWER_NAME_MAX];
 } __attribute__((__packed__));
 
 struct lttng_viewer_stream {
        uint64_t id;
        uint64_t ctf_trace_id;
 } __attribute__((__packed__));
 
 struct lttng_viewer_stream {
        uint64_t id;
        uint64_t ctf_trace_id;
+       int metadata_flag;
        char path_name[LTTNG_VIEWER_PATH_MAX];
        char channel_name[LTTNG_VIEWER_NAME_MAX];
        char path_name[LTTNG_VIEWER_PATH_MAX];
        char channel_name[LTTNG_VIEWER_NAME_MAX];
-       int metadata_flag;
 } __attribute__((__packed__));
 
 struct lttng_viewer_cmd {
 } __attribute__((__packed__));
 
 struct lttng_viewer_cmd {
@@ -110,10 +115,11 @@ struct lttng_viewer_cmd {
  * CONNECT payload.
  */
 struct lttng_viewer_connect {
  * CONNECT payload.
  */
 struct lttng_viewer_connect {
+       /* session ID assigned by the relay for command connections */
+       uint64_t viewer_session_id;
        uint32_t major;
        uint32_t minor;
        uint32_t type; /* enum lttng_viewer_connection_type */
        uint32_t major;
        uint32_t minor;
        uint32_t type; /* enum lttng_viewer_connection_type */
-       uint64_t viewer_session_id; /* session ID assigned by the relay for command connections */
 } __attribute__((__packed__));
 
 /*
 } __attribute__((__packed__));
 
 /*
@@ -129,14 +135,16 @@ struct lttng_viewer_list_sessions {
  */
 struct lttng_viewer_attach_session_request {
        uint64_t session_id;
  */
 struct lttng_viewer_attach_session_request {
        uint64_t session_id;
-       uint32_t seek;          /* enum lttng_viewer_seek */
        uint64_t offset;        /* unused for now */
        uint64_t offset;        /* unused for now */
+       uint32_t seek;          /* enum lttng_viewer_seek */
 } __attribute__((__packed__));
 
 struct lttng_viewer_attach_session_response {
 } __attribute__((__packed__));
 
 struct lttng_viewer_attach_session_response {
-       uint32_t status;                /* enum lttng_viewer_attach_return_code */
+       /* enum lttng_viewer_attach_return_code */
+       uint32_t status;
        uint32_t streams_count;
        uint32_t streams_count;
-       char stream_list[];             /* struct lttng_viewer_stream */
+       /* struct lttng_viewer_stream */
+       char stream_list[];
 } __attribute__((__packed__));
 
 /*
 } __attribute__((__packed__));
 
 /*
@@ -147,7 +155,6 @@ struct lttng_viewer_get_next_index {
 } __attribute__ ((__packed__));
 
 struct lttng_viewer_index {
 } __attribute__ ((__packed__));
 
 struct lttng_viewer_index {
-       uint32_t status;        /* enum lttng_viewer_next_index_return_code */
        uint64_t offset;
        uint64_t packet_size;
        uint64_t content_size;
        uint64_t offset;
        uint64_t packet_size;
        uint64_t content_size;
@@ -155,6 +162,8 @@ struct lttng_viewer_index {
        uint64_t timestamp_end;
        uint64_t events_discarded;
        uint64_t stream_id;
        uint64_t timestamp_end;
        uint64_t events_discarded;
        uint64_t stream_id;
+       /* enum lttng_viewer_next_index_return_code */
+       uint32_t status;
        uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
 } __attribute__ ((__packed__));
 
        uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
 } __attribute__ ((__packed__));
 
@@ -168,7 +177,8 @@ struct lttng_viewer_get_packet {
 } __attribute__((__packed__));
 
 struct lttng_viewer_trace_packet {
 } __attribute__((__packed__));
 
 struct lttng_viewer_trace_packet {
-       uint32_t status;                /* enum lttng_viewer_get_packet_return_code */
+       /* enum lttng_viewer_get_packet_return_code */
+       uint32_t status;
        uint32_t len;
        uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
        char data[];
        uint32_t len;
        uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
        char data[];
@@ -182,8 +192,9 @@ struct lttng_viewer_get_metadata {
 } __attribute__((__packed__));
 
 struct lttng_viewer_metadata_packet {
 } __attribute__((__packed__));
 
 struct lttng_viewer_metadata_packet {
-       uint32_t status;                /* enum lttng_viewer_get_metadata_return_code */
        uint64_t len;
        uint64_t len;
+       /* enum lttng_viewer_get_metadata_return_code */
+       uint32_t status;
        char data[];
 } __attribute__((__packed__));
 
        char data[];
 } __attribute__((__packed__));
 
index 9baaff3f94bfc0aa9b8b0a9699a5f03197eb19de..ec8839c37220e41595c8d162637936a61b4b4799 100644 (file)
@@ -52,7 +52,7 @@
 #include "common.h"
 #include "network-live.h"
 
 #include "common.h"
 #include "network-live.h"
 
-#include "lttng-index.h"
+#include "ctf-index.h"
 
 #define DEFAULT_FILE_ARRAY_SIZE 1
 
 
 #define DEFAULT_FILE_ARRAY_SIZE 1
 
index 1fb761ef828878ef9279343b7b214ee9a6bef42d..46a5b4d2d0c317cd80de5be78c527b24c7871452 100644 (file)
@@ -35,7 +35,7 @@
 #include <sys/mman.h>
 
 #include "lttng-viewer.h"
 #include <sys/mman.h>
 
 #include "lttng-viewer.h"
-#include "lttng-index.h"
+#include "ctf-index.h"
 #include "network-live.h"
 
 #include <babeltrace/babeltrace.h>
 #include "network-live.h"
 
 #include <babeltrace/babeltrace.h>
@@ -220,27 +220,6 @@ error:
        return ret;
 }
 
        return ret;
 }
 
-int write_index_header(int fd)
-{
-       struct lttng_packet_index_file_hdr hdr;
-       int ret;
-
-       memcpy(hdr.magic, INDEX_MAGIC, sizeof(hdr.magic));
-       hdr.index_major = htobe32(INDEX_MAJOR);
-       hdr.index_minor = htobe32(INDEX_MINOR);
-
-       do {
-               ret = write(fd, &hdr, sizeof(hdr));
-       } while (ret < 0 && errno == EINTR);
-       if (ret < 0) {
-               perror("write index header");
-               goto error;
-       }
-
-error:
-       return ret;
-}
-
 static
 int attach_session(int id, int begin)
 {
 static
 int attach_session(int id, int begin)
 {
@@ -675,6 +654,11 @@ void ctf_live_packet_seek(struct bt_stream_pos *stream_pos, size_t index,
        pos->content_size = packet_index.content_size;
        pos->mmap_base_offset = 0;
        pos->offset = 0;
        pos->content_size = packet_index.content_size;
        pos->mmap_base_offset = 0;
        pos->offset = 0;
+       if (packet_index.offset == EOF) {
+               pos->offset = EOF;
+       } else {
+               pos->offset = 0;
+       }
 
        file_stream->parent.cycles_timestamp = packet_index.timestamp_end;
        file_stream->parent.real_timestamp = ctf_get_real_timestamp(
 
        file_stream->parent.cycles_timestamp = packet_index.timestamp_end;
        file_stream->parent.real_timestamp = ctf_get_real_timestamp(
index e6cf7d75215842ade56838cd5f80a3b867a6039b..b84fc0ba645b057a9ebdd2b8f57f9076c495c59b 100644 (file)
@@ -21,7 +21,7 @@
 #include <lib/babeltrace/ctf/types.h>
 #include <lib/babeltrace/ctf-ir/metadata.h>
 #include <lib/babeltrace/clock-internal.h>
 #include <lib/babeltrace/ctf/types.h>
 #include <lib/babeltrace/ctf-ir/metadata.h>
 #include <lib/babeltrace/clock-internal.h>
-#include "lttng-index.h"
+#include "ctf-index.h"
 
 /* Copied from babeltrace/formats/ctf/events-private.h */
 static inline
 
 /* Copied from babeltrace/formats/ctf/events-private.h */
 static inline
@@ -44,8 +44,7 @@ uint64_t ctf_get_real_timestamp(struct ctf_stream_definition *stream,
 }
 
 int list_sessions(void);
 }
 
 int list_sessions(void);
-int write_index_header(int fd);
-void dump_packet_index(struct lttng_packet_index *index);
+void dump_packet_index(struct ctf_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 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);
This page took 0.027106 seconds and 4 git commands to generate.