begin support for UST in live, not yet perfect but starting to work
[lttngtop.git] / src / common.c
index 9f89391b612af6a485fcc6a1167fcf63527dcf99..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;
        }
 
@@ -86,7 +94,7 @@ uint64_t get_context_ppid(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);
@@ -101,7 +109,7 @@ uint64_t get_context_vtid(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);
@@ -116,7 +124,7 @@ uint64_t get_context_vpid(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);
@@ -147,7 +155,7 @@ char *get_context_comm(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);
@@ -164,7 +172,7 @@ char *get_context_hostname(const struct bt_ctf_event *event)
  * To get the parent process, put the pid in the tid field
  * because the parent process gets pid = tid
  */
-struct processtop *find_process_tid(struct lttngtop *ctx, int tid, char *comm)
+struct processtop *find_process_tid(struct lttngtop *ctx, int tid, const char *comm)
 {
        struct processtop *tmp;
 
@@ -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:
This page took 0.023529 seconds and 4 git commands to generate.