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;
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;
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;
}
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 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 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);
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);
* 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;
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"));
proc->pid = pid;
}
+end:
return BT_CB_OK;
error:
}
}
}
+
+char *lookup_procname(const char *procname)
+{
+ if (!procname || !global_procname_list)
+ return NULL;
+
+ return g_hash_table_lookup(global_procname_list, (gpointer) procname);
+}
+
+char *add_procname_list(char *procname, int filter)
+{
+ char *proc;
+
+ proc = lookup_procname(procname);
+ if (proc)
+ return proc;
+
+ proc = strdup(procname);
+ g_hash_table_insert(global_procname_list,
+ (gpointer) procname, (gpointer) procname);
+
+ return proc;
+}