X-Git-Url: https://git.lttng.org/?p=lttngtop.git;a=blobdiff_plain;f=src%2Fiostreamtop.c;h=4426d03c27ca243f32c52731114a4fd300018855;hp=a1c78a98a63e13329eaafd0b342727f3b5894cdd;hb=1dec520a9e8e0654fa7fab2310a0191b2836d424;hpb=b093de8aa1ac7555d20b3aa4227d4675b39ef008 diff --git a/src/iostreamtop.c b/src/iostreamtop.c index a1c78a9..4426d03 100644 --- a/src/iostreamtop.c +++ b/src/iostreamtop.c @@ -101,7 +101,7 @@ void show_table(GPtrArray *tab) } int update_iostream_ret(struct lttngtop *ctx, int tid, char *comm, - unsigned long timestamp, int cpu_id, int ret) + unsigned long timestamp, uint64_t cpu_id, int ret) { struct processtop *tmp; struct files *tmpfile; @@ -134,7 +134,7 @@ int update_iostream_ret(struct lttngtop *ctx, int tid, char *comm, return err; } -struct syscalls *create_syscall_info(unsigned int type, unsigned int cpu_id, +struct syscalls *create_syscall_info(unsigned int type, uint64_t cpu_id, unsigned int tid, int fd) { struct syscalls *syscall_info; @@ -171,27 +171,14 @@ enum bt_cb_ret handle_exit_syscall(struct bt_ctf_event *call_data, unsigned long timestamp; char *comm; uint64_t ret, tid; - int64_t cpu_id; + uint64_t cpu_id; timestamp = bt_ctf_get_timestamp(call_data); if (timestamp == -1ULL) goto error; - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_EVENT_CONTEXT); - comm = bt_ctf_get_char_array(bt_ctf_get_field(call_data, - scope, "_procname")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing procname context info\n"); - goto error; - } - - tid = bt_ctf_get_int64(bt_ctf_get_field(call_data, - scope, "_tid")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing tid context info\n"); - goto error; - } + comm = get_context_comm(call_data); + tid = get_context_tid(call_data); scope = bt_ctf_get_top_level_scope(call_data, BT_EVENT_FIELDS); @@ -202,14 +189,7 @@ enum bt_cb_ret handle_exit_syscall(struct bt_ctf_event *call_data, goto error; } - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_PACKET_CONTEXT); - cpu_id = bt_ctf_get_uint64(bt_ctf_get_field(call_data, - scope, "cpu_id")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing cpu_id context info\n"); - goto error; - } + cpu_id = get_cpu_id(call_data); /* * if we encounter an exit_syscall and @@ -241,30 +221,9 @@ enum bt_cb_ret handle_sys_write(struct bt_ctf_event *call_data, if (timestamp == -1ULL) goto error; - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_EVENT_CONTEXT); - comm = bt_ctf_get_char_array(bt_ctf_get_field(call_data, - scope, "_procname")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing procname context info\n"); - goto error; - } - - tid = bt_ctf_get_int64(bt_ctf_get_field(call_data, - scope, "_tid")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing tid context info\n"); - goto error; - } - - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_PACKET_CONTEXT); - cpu_id = bt_ctf_get_uint64(bt_ctf_get_field(call_data, - scope, "cpu_id")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing cpu_id context info\n"); - goto error; - } + comm = get_context_comm(call_data); + tid = get_context_tid(call_data); + cpu_id = get_cpu_id(call_data); scope = bt_ctf_get_top_level_scope(call_data, BT_EVENT_FIELDS); @@ -301,30 +260,9 @@ enum bt_cb_ret handle_sys_read(struct bt_ctf_event *call_data, if (timestamp == -1ULL) goto error; - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_EVENT_CONTEXT); - comm = bt_ctf_get_char_array(bt_ctf_get_field(call_data, - scope, "_procname")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing procname context info\n"); - goto error; - } - - tid = bt_ctf_get_int64(bt_ctf_get_field(call_data, - scope, "_tid")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing tid context info\n"); - goto error; - } - - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_PACKET_CONTEXT); - cpu_id = bt_ctf_get_uint64(bt_ctf_get_field(call_data, - scope, "cpu_id")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing cpu_id context info\n"); - goto error; - } + comm = get_context_comm(call_data); + tid = get_context_tid(call_data); + cpu_id = get_cpu_id(call_data); scope = bt_ctf_get_top_level_scope(call_data, BT_EVENT_FIELDS); @@ -363,30 +301,9 @@ enum bt_cb_ret handle_sys_open(struct bt_ctf_event *call_data, if (timestamp == -1ULL) goto error; - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_EVENT_CONTEXT); - comm = bt_ctf_get_char_array(bt_ctf_get_field(call_data, - scope, "_procname")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing procname context info\n"); - goto error; - } - - tid = bt_ctf_get_int64(bt_ctf_get_field(call_data, - scope, "_tid")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing tid context info\n"); - goto error; - } - - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_PACKET_CONTEXT); - cpu_id = bt_ctf_get_uint64(bt_ctf_get_field(call_data, - scope, "cpu_id")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing cpu_id context info\n"); - goto error; - } + comm = get_context_comm(call_data); + tid = get_context_tid(call_data); + cpu_id = get_cpu_id(call_data); scope = bt_ctf_get_top_level_scope(call_data, BT_EVENT_FIELDS); @@ -423,21 +340,8 @@ enum bt_cb_ret handle_sys_close(struct bt_ctf_event *call_data, if (timestamp == -1ULL) goto error; - scope = bt_ctf_get_top_level_scope(call_data, - BT_STREAM_EVENT_CONTEXT); - comm = bt_ctf_get_char_array(bt_ctf_get_field(call_data, - scope, "_procname")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing procname context info\n"); - goto error; - } - - tid = bt_ctf_get_int64(bt_ctf_get_field(call_data, - scope, "_tid")); - if (bt_ctf_field_get_error()) { - fprintf(stderr, "Missing tid context info\n"); - goto error; - } + comm = get_context_comm(call_data); + tid = get_context_tid(call_data); scope = bt_ctf_get_top_level_scope(call_data, BT_EVENT_FIELDS);