begin support for UST in live, not yet perfect but starting to work
authorJulien Desfossez <jdesfossez@efficios.com>
Mon, 10 Feb 2014 21:53:09 +0000 (16:53 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Mon, 10 Feb 2014 21:53:09 +0000 (16:53 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/common.c
src/liblttng-live.c
src/lttngtop.c
src/lttngtop.h

index 31fa9055ce59548b42e134704d71be77f536638a..456e0a5c2086c029741a2b6693cf8b770b96253e 100644 (file)
@@ -45,8 +45,12 @@ uint64_t get_context_tid(const struct bt_ctf_event *event)
        tid = bt_ctf_get_int64(bt_ctf_get_field(event,
                                scope, "_tid"));
        if (bt_ctf_field_get_error()) {
-               fprintf(stderr, "Missing tid context info\n");
-               return -1ULL;
+               tid = bt_ctf_get_int64(bt_ctf_get_field(event,
+                                       scope, "_vtid"));
+               if (bt_ctf_field_get_error()) {
+                       fprintf(stderr, "Missing tid context info\n");
+                       return -1ULL;
+               }
        }
 
        return tid;
@@ -61,8 +65,13 @@ uint64_t get_context_pid(const struct bt_ctf_event *event)
        pid = bt_ctf_get_int64(bt_ctf_get_field(event,
                                scope, "_pid"));
        if (bt_ctf_field_get_error()) {
-               fprintf(stderr, "Missing pid context info\n");
-               return -1ULL;
+               /* Try UST pid */
+               pid = bt_ctf_get_int64(bt_ctf_get_field(event,
+                                       scope, "_vpid"));
+               if (bt_ctf_field_get_error()) {
+                       fprintf(stderr, "Missing pid context info\n");
+                       return -1ULL;
+               }
        }
 
        return pid;
@@ -77,7 +86,6 @@ uint64_t get_context_ppid(const struct bt_ctf_event *event)
        ppid = bt_ctf_get_int64(bt_ctf_get_field(event,
                                scope, "_ppid"));
        if (bt_ctf_field_get_error()) {
-               fprintf(stderr, "Missing ppid context info\n");
                return -1ULL;
        }
 
@@ -599,8 +607,7 @@ enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data,
        ppid = bt_ctf_get_int64(bt_ctf_get_field(call_data,
                                scope, "_ppid"));
        if (bt_ctf_field_get_error()) {
-               fprintf(stderr, "Missing ppid context info\n");
-               goto error;
+               goto end;
        }
        tid = bt_ctf_get_int64(bt_ctf_get_field(call_data,
                                scope, "_tid"));
@@ -647,6 +654,7 @@ enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data,
                proc->pid = pid;
        }
 
+end:
        return BT_CB_OK;
 
 error:
index 8d91e3219ac77eba8638073d942c63ccf2fecae5..d531882c58eabfcda3979f43349f8f354df28531 100644 (file)
@@ -424,8 +424,8 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
                ret = 0;
                goto end;
        }
-       printf_verbose("Waiting for %" PRIu64 " streams:\n",
-               ctx->session->stream_count);
+       printf_verbose("Waiting for %u streams:\n",
+               be32toh(rp.streams_count));
        ctx->session->streams = g_new0(struct lttng_live_viewer_stream,
                        ctx->session->stream_count);
        for (i = 0; i < be32toh(rp.streams_count); i++) {
@@ -610,11 +610,14 @@ int get_data_packet(struct lttng_live_ctx *ctx,
                        goto end;
                }
                if (rp.flags & LTTNG_VIEWER_FLAG_NEW_STREAM) {
+                       printf_verbose("get_data_packet: new streams needed\n");
                        ret = ask_new_streams(ctx);
                        if (ret < 0)
                                goto error;
                        g_hash_table_foreach(ctx->session->ctf_traces, add_traces,
                                        ctx->bt_ctx);
+                       ret = 0;
+                       goto end;
                }
                fprintf(stderr, "[error] get_data_packet: error\n");
                ret = -1;
@@ -1399,7 +1402,7 @@ void lttng_live_read(struct lttng_live_ctx *ctx)
                bt_ctf_iter_destroy(iter);
 #endif
                ret = check_requirements(ctx->bt_ctx);
-               if (ret < 0) {
+               if (ret < 0 && !valid_trace) {
                        fprintf(stderr, "[error] some mandatory contexts "
                                        "were missing, exiting.\n");
                        goto end;
index 03d79d4c907ad678fb4d3ff6697ea07696f0c591..326bae832c34745517a4d680325ea496161c9853 100644 (file)
@@ -66,6 +66,8 @@ int opt_begin;
 int opt_all;
 
 int quit = 0;
+/* We need at least one valid trace to start processing. */
+int valid_trace = 0;
 
 struct lttngtop *copy;
 pthread_t display_thread;
@@ -569,7 +571,7 @@ enum bt_cb_ret fix_process_table(struct bt_ctf_event *call_data,
        }
        ppid = get_context_ppid(call_data);
        if (ppid == -1ULL) {
-               goto error;
+               goto end;
        }
        vpid = get_context_vpid(call_data);
        if (pid == -1ULL) {
@@ -1163,6 +1165,9 @@ int check_requirements(struct bt_context *ctx)
                ret = -1;
                fprintf(stderr, "[error] missing procname context information\n");
        }
+       if (ret == 0) {
+               valid_trace = 1;
+       }
 
 end:
        return ret;
@@ -1239,10 +1244,10 @@ int main(int argc, char **argv, char **envp)
                }
 
                ret = check_requirements(bt_ctx);
-               if (ret < 0) {
+               if (ret < 0 && !valid_trace) {
                        fprintf(stderr, "[error] some mandatory contexts "
                                        "were missing, exiting.\n");
-                       goto end;
+                       //goto end;
                }
 
                if (!opt_textdump) {
index 526bfdc1cc06249c95159674ec847cf45a22c722..985777f6123a9fb90fbfddaa81aa7a59a6842c1e 100644 (file)
@@ -22,6 +22,7 @@ int check_requirements(struct bt_context *ctx);
 extern int opt_textdump;
 extern int opt_child;
 extern int opt_begin;
+extern int valid_trace;
 
 extern pthread_t display_thread;
 extern pthread_t timer_thread;
This page took 0.026433 seconds and 4 git commands to generate.