X-Git-Url: https://git.lttng.org/?p=lttngtop.git;a=blobdiff_plain;f=src%2Fcommon.c;h=f628ed56d5961673017aef03c3f256913b23f080;hp=f0b7af064d6a6cd4cd954c88aff14f5d38e29e57;hb=d67167cde319ac9d257f5b59b5a4664e558f4cb4;hpb=14a97415ba61ac79cec3d315a8b31feae48cc7a5 diff --git a/src/common.c b/src/common.c index f0b7af0..f628ed5 100644 --- a/src/common.c +++ b/src/common.c @@ -20,6 +20,21 @@ #include #include "common.h" +uint64_t get_cpu_id(struct bt_ctf_event *event) +{ + struct definition *scope; + uint64_t cpu_id; + + scope = bt_ctf_get_top_level_scope(event, BT_STREAM_PACKET_CONTEXT); + cpu_id = bt_ctf_get_uint64(bt_ctf_get_field(event, scope, "cpu_id")); + if (bt_ctf_field_get_error()) { + fprintf(stderr, "[error] get cpu_id\n"); + return -1ULL; + } + + return cpu_id; +} + struct processtop *find_process_tid(struct lttngtop *ctx, int tid, char *comm) { gint i;