From: Julien Desfossez Date: Mon, 10 Feb 2014 21:53:09 +0000 (-0500) Subject: begin support for UST in live, not yet perfect but starting to work X-Git-Tag: v0.3~42 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8fe4d0cfce4c1b1ace5aed2b2b1521caca113bd5;p=lttngtop.git begin support for UST in live, not yet perfect but starting to work Signed-off-by: Julien Desfossez --- diff --git a/src/common.c b/src/common.c index 31fa905..456e0a5 100644 --- a/src/common.c +++ b/src/common.c @@ -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: diff --git a/src/liblttng-live.c b/src/liblttng-live.c index 8d91e32..d531882 100644 --- a/src/liblttng-live.c +++ b/src/liblttng-live.c @@ -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; diff --git a/src/lttngtop.c b/src/lttngtop.c index 03d79d4..326bae8 100644 --- a/src/lttngtop.c +++ b/src/lttngtop.c @@ -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) { diff --git a/src/lttngtop.h b/src/lttngtop.h index 526bfdc..985777f 100644 --- a/src/lttngtop.h +++ b/src/lttngtop.h @@ -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;