X-Git-Url: https://git.lttng.org/?p=lttngtop.git;a=blobdiff_plain;f=src%2Fcommon.c;h=bff5b00715685b312c7ad3745811776b7a473e3d;hp=5bbbf992d0adc34279e6ed7ea16eec2bc86e60f8;hb=b520ab458ea26829d00fca98f4bbb90309fd30df;hpb=0d91c12a62aa85d1d1d8b5478e81d38e06f2cc00 diff --git a/src/common.c b/src/common.c index 5bbbf99..bff5b00 100644 --- a/src/common.c +++ b/src/common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Julien Desfossez + * Copyright (C) 2011-2012 Julien Desfossez * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 as @@ -23,7 +23,7 @@ uint64_t get_cpu_id(const struct bt_ctf_event *event) { - const struct definition *scope; + const struct bt_definition *scope; uint64_t cpu_id; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_PACKET_CONTEXT); @@ -38,7 +38,7 @@ uint64_t get_cpu_id(const struct bt_ctf_event *event) uint64_t get_context_tid(const struct bt_ctf_event *event) { - const struct definition *scope; + const struct bt_definition *scope; uint64_t tid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -54,7 +54,7 @@ uint64_t get_context_tid(const struct bt_ctf_event *event) uint64_t get_context_pid(const struct bt_ctf_event *event) { - const struct definition *scope; + const struct bt_definition *scope; uint64_t pid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -70,7 +70,7 @@ uint64_t get_context_pid(const struct bt_ctf_event *event) uint64_t get_context_ppid(const struct bt_ctf_event *event) { - const struct definition *scope; + const struct bt_definition *scope; uint64_t ppid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -86,7 +86,7 @@ uint64_t get_context_ppid(const struct bt_ctf_event *event) char *get_context_comm(const struct bt_ctf_event *event) { - const struct definition *scope; + const struct bt_definition *scope; char *comm; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -464,7 +464,7 @@ struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end) enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data, void *private_data) { - const struct definition *scope; + const struct bt_definition *scope; struct processtop *proc; unsigned long timestamp; int64_t pid, tid; @@ -529,3 +529,20 @@ enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data, error: return BT_CB_ERROR_STOP; } + +struct tm format_timestamp(uint64_t timestamp) +{ + struct tm tm; + uint64_t ts_sec = 0, ts_nsec; + time_t time_s; + + ts_nsec = timestamp; + ts_sec += ts_nsec / NSEC_PER_SEC; + ts_nsec = ts_nsec % NSEC_PER_SEC; + + time_s = (time_t) ts_sec; + + localtime_r(&time_s, &tm); + + return tm; +}