begin or tail in live mode
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 17 Oct 2013 23:59:07 +0000 (19:59 -0400)
committerJulien Desfossez <jdesfossez@efficios.com>
Sat, 19 Oct 2013 16:02:38 +0000 (12:02 -0400)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/common.c
src/lttngtop.c
src/network-live.c
src/network-live.h

index 9f89391b612af6a485fcc6a1167fcf63527dcf99..0a38bf36423769d069eaed4accf28b47fce4e678 100644 (file)
@@ -86,7 +86,7 @@ uint64_t get_context_ppid(const struct bt_ctf_event *event)
 
 uint64_t get_context_vtid(const struct bt_ctf_event *event)
 {
 
 uint64_t get_context_vtid(const struct bt_ctf_event *event)
 {
-       const struct definition *scope;
+       const struct bt_definition *scope;
        uint64_t vtid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
        uint64_t vtid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
@@ -101,7 +101,7 @@ uint64_t get_context_vtid(const struct bt_ctf_event *event)
 
 uint64_t get_context_vpid(const struct bt_ctf_event *event)
 {
 
 uint64_t get_context_vpid(const struct bt_ctf_event *event)
 {
-       const struct definition *scope;
+       const struct bt_definition *scope;
        uint64_t vpid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
        uint64_t vpid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
@@ -116,7 +116,7 @@ uint64_t get_context_vpid(const struct bt_ctf_event *event)
 
 uint64_t get_context_vppid(const struct bt_ctf_event *event)
 {
 
 uint64_t get_context_vppid(const struct bt_ctf_event *event)
 {
-       const struct definition *scope;
+       const struct bt_definition *scope;
        uint64_t vppid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
        uint64_t vppid;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
@@ -147,7 +147,7 @@ char *get_context_comm(const struct bt_ctf_event *event)
 
 char *get_context_hostname(const struct bt_ctf_event *event)
 {
 
 char *get_context_hostname(const struct bt_ctf_event *event)
 {
-       const struct definition *scope;
+       const struct bt_definition *scope;
        char *hostname;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
        char *hostname;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
index b9646e0a3b1dbebea5037bd45cc325e1da7ae7b3..2800cfac124a208698f47396e89659e8342850d5 100644 (file)
@@ -59,6 +59,7 @@
 const char *opt_input_path;
 static int opt_textdump;
 static int opt_child;
 const char *opt_input_path;
 static int opt_textdump;
 static int opt_child;
+static int opt_begin;
 
 int quit = 0;
 
 
 int quit = 0;
 
@@ -91,6 +92,7 @@ enum {
        OPT_HOSTNAME,
        OPT_RELAY_HOSTNAME,
        OPT_KPROBES,
        OPT_HOSTNAME,
        OPT_RELAY_HOSTNAME,
        OPT_KPROBES,
+       OPT_BEGIN,
 };
 
 static struct poptOption long_options[] = {
 };
 
 static struct poptOption long_options[] = {
@@ -98,6 +100,7 @@ static struct poptOption long_options[] = {
        { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
        { "textdump", 't', POPT_ARG_NONE, NULL, OPT_TEXTDUMP, NULL, NULL },
        { "child", 'f', POPT_ARG_NONE, NULL, OPT_CHILD, NULL, NULL },
        { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
        { "textdump", 't', POPT_ARG_NONE, NULL, OPT_TEXTDUMP, NULL, NULL },
        { "child", 'f', POPT_ARG_NONE, NULL, OPT_CHILD, NULL, NULL },
+       { "begin", 'b', POPT_ARG_NONE, NULL, OPT_BEGIN, NULL, NULL },
        { "pid", 'p', POPT_ARG_STRING, &opt_tid, OPT_PID, NULL, NULL },
        { "hostname", 'n', POPT_ARG_STRING, &opt_hostname, OPT_HOSTNAME, NULL, NULL },
        { "relay-hostname", 'r', POPT_ARG_STRING, &opt_relay_hostname,
        { "pid", 'p', POPT_ARG_STRING, &opt_tid, OPT_PID, NULL, NULL },
        { "hostname", 'n', POPT_ARG_STRING, &opt_hostname, OPT_HOSTNAME, NULL, NULL },
        { "relay-hostname", 'r', POPT_ARG_STRING, &opt_relay_hostname,
@@ -664,6 +667,10 @@ static int parse_options(int argc, char **argv)
                                        tmp_str = strtok(NULL, ",");
                                }
                                break;
                                        tmp_str = strtok(NULL, ",");
                                }
                                break;
+                       case OPT_BEGIN:
+                               /* start reading the live trace from the beginning */
+                               opt_begin = 1;
+                               break;
                        case OPT_HOSTNAME:
                                toggle_filter = 1;
                                tmp_str = strtok(opt_hostname, ",");
                        case OPT_HOSTNAME:
                                toggle_filter = 1;
                                tmp_str = strtok(opt_hostname, ",");
@@ -1036,7 +1043,7 @@ int main(int argc, char **argv)
 #endif /* LTTNGTOP_MMAP_LIVE */
        } else if (!opt_input_path && remote_live) {
                /* network live */
 #endif /* LTTNGTOP_MMAP_LIVE */
        } else if (!opt_input_path && remote_live) {
                /* network live */
-               ret = setup_network_live(opt_relay_hostname);
+               ret = setup_network_live(opt_relay_hostname, opt_begin);
                if (ret < 0) {
                        goto end;
                }
                if (ret < 0) {
                        goto end;
                }
index a0113f5efd3995126cfeb242468c220e714b7b49..1fb761ef828878ef9279343b7b214ee9a6bef42d 100644 (file)
@@ -241,7 +241,8 @@ error:
        return ret;
 }
 
        return ret;
 }
 
-int attach_session(int id)
+static
+int attach_session(int id, int begin)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_attach_session_request rq;
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_attach_session_request rq;
@@ -254,8 +255,11 @@ int attach_session(int id)
        cmd.cmd_version = 0;
 
        rq.session_id = htobe64(id);
        cmd.cmd_version = 0;
 
        rq.session_id = htobe64(id);
-       //rq.seek = htobe32(VIEWER_SEEK_BEGINNING);
-       rq.seek = htobe32(VIEWER_SEEK_LAST);
+       if (begin) {
+               rq.seek = htobe32(VIEWER_SEEK_BEGINNING);
+       } else {
+               rq.seek = htobe32(VIEWER_SEEK_LAST);
+       }
 
        do {
                ret = send(control_sock, &cmd, sizeof(cmd), 0);
 
        do {
                ret = send(control_sock, &cmd, sizeof(cmd), 0);
@@ -801,7 +805,7 @@ end:
        return ret;
 }
 
        return ret;
 }
 
-int setup_network_live(char *hostname)
+int setup_network_live(char *hostname, int begin)
 {
        int ret;
        int session_id;
 {
        int ret;
        int session_id;
@@ -837,7 +841,7 @@ int setup_network_live(char *hostname)
 
        do {
                fprintf(stderr, "* Attach session %d\n", ret);
 
        do {
                fprintf(stderr, "* Attach session %d\n", ret);
-               ret = attach_session(session_id);
+               ret = attach_session(session_id, begin);
                if (ret < 0) {
                        goto error;
                }
                if (ret < 0) {
                        goto error;
                }
index 6228865d7d4bab232841b674efeb0dc363045553..e6cf7d75215842ade56838cd5f80a3b867a6039b 100644 (file)
@@ -45,12 +45,11 @@ uint64_t ctf_get_real_timestamp(struct ctf_stream_definition *stream,
 
 int list_sessions(void);
 int write_index_header(int fd);
 
 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);
 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);
+int setup_network_live(char *hostname, int begin);
 
 #endif /* _LIVE_H */
 
 #endif /* _LIVE_H */
This page took 0.026892 seconds and 4 git commands to generate.