From: Julien Desfossez Date: Tue, 13 Mar 2012 18:35:09 +0000 (-0400) Subject: Add const for most of the babeltrace APi calls X-Git-Tag: v0.2~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3ba84bed69e8eb8e6794a7250da97406dbbe02c2;p=lttngtop.git Add const for most of the babeltrace APi calls Signed-off-by: Julien Desfossez --- diff --git a/src/common.c b/src/common.c index ad190c9..df2ef7a 100644 --- a/src/common.c +++ b/src/common.c @@ -20,9 +20,9 @@ #include #include "common.h" -uint64_t get_cpu_id(struct bt_ctf_event *event) +uint64_t get_cpu_id(const struct bt_ctf_event *event) { - struct definition *scope; + const struct definition *scope; uint64_t cpu_id; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_PACKET_CONTEXT); @@ -35,9 +35,9 @@ uint64_t get_cpu_id(struct bt_ctf_event *event) return cpu_id; } -uint64_t get_context_tid(struct bt_ctf_event *event) +uint64_t get_context_tid(const struct bt_ctf_event *event) { - struct definition *scope; + const struct definition *scope; uint64_t tid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -51,9 +51,9 @@ uint64_t get_context_tid(struct bt_ctf_event *event) return tid; } -uint64_t get_context_pid(struct bt_ctf_event *event) +uint64_t get_context_pid(const struct bt_ctf_event *event) { - struct definition *scope; + const struct definition *scope; uint64_t pid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -67,9 +67,9 @@ uint64_t get_context_pid(struct bt_ctf_event *event) return pid; } -uint64_t get_context_ppid(struct bt_ctf_event *event) +uint64_t get_context_ppid(const struct bt_ctf_event *event) { - struct definition *scope; + const struct definition *scope; uint64_t ppid; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); @@ -83,9 +83,9 @@ uint64_t get_context_ppid(struct bt_ctf_event *event) return ppid; } -char *get_context_comm(struct bt_ctf_event *event) +char *get_context_comm(const struct bt_ctf_event *event) { - struct definition *scope; + const struct definition *scope; char *comm; scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT); diff --git a/src/common.h b/src/common.h index cfa68cd..6370b77 100644 --- a/src/common.h +++ b/src/common.h @@ -52,10 +52,10 @@ struct perfcounter *get_perf_counter(const char *name, struct processtop *proc, struct cputime *cpu); /* common field access functions */ -uint64_t get_cpu_id(struct bt_ctf_event *event); -uint64_t get_context_tid(struct bt_ctf_event *event); -uint64_t get_context_pid(struct bt_ctf_event *event); -uint64_t get_context_ppid(struct bt_ctf_event *event); -char *get_context_comm(struct bt_ctf_event *event); +uint64_t get_cpu_id(const struct bt_ctf_event *event); +uint64_t get_context_tid(const struct bt_ctf_event *event); +uint64_t get_context_pid(const struct bt_ctf_event *event); +uint64_t get_context_ppid(const struct bt_ctf_event *event); +char *get_context_comm(const struct bt_ctf_event *event); #endif /* _COMMON_H */ diff --git a/src/cputop.c b/src/cputop.c index d652b5b..c561d47 100644 --- a/src/cputop.c +++ b/src/cputop.c @@ -48,7 +48,7 @@ void update_cputop_data(unsigned long timestamp, int64_t cpu, int prev_pid, enum bt_cb_ret handle_sched_switch(struct bt_ctf_event *call_data, void *private_data) { - struct definition *scope; + const struct definition *scope; unsigned long timestamp; uint64_t cpu_id; char *prev_comm, *next_comm; @@ -102,7 +102,7 @@ error: enum bt_cb_ret handle_sched_process_free(struct bt_ctf_event *call_data, void *private_data) { - struct definition *scope; + const struct definition *scope; unsigned long timestamp; char *comm; int tid; diff --git a/src/iostreamtop.c b/src/iostreamtop.c index c47926f..e3a6434 100644 --- a/src/iostreamtop.c +++ b/src/iostreamtop.c @@ -166,7 +166,7 @@ struct file_history *create_file(struct file_history *history, char *file_name) enum bt_cb_ret handle_exit_syscall(struct bt_ctf_event *call_data, void *private_data) { - struct definition *scope; + const struct definition *scope; unsigned long timestamp; char *comm; uint64_t ret, tid; @@ -208,7 +208,7 @@ error: enum bt_cb_ret handle_sys_write(struct bt_ctf_event *call_data, void *private_data) { - struct definition *scope; + const struct definition *scope; struct processtop *tmp; unsigned long timestamp; uint64_t cpu_id; @@ -248,7 +248,7 @@ enum bt_cb_ret handle_sys_read(struct bt_ctf_event *call_data, void *private_data) { struct processtop *tmp; - struct definition *scope; + const struct definition *scope; unsigned long timestamp; uint64_t cpu_id; char *comm; @@ -289,7 +289,7 @@ enum bt_cb_ret handle_sys_open(struct bt_ctf_event *call_data, { struct processtop *tmp; - struct definition *scope; + const struct definition *scope; unsigned long timestamp; uint64_t cpu_id; char *comm; @@ -328,7 +328,7 @@ error: enum bt_cb_ret handle_sys_close(struct bt_ctf_event *call_data, void *private_data) { - struct definition *scope; + const struct definition *scope; unsigned long timestamp; int64_t tid; struct processtop *tmp; diff --git a/src/lttngtop.c b/src/lttngtop.c index 95bd383..cc0ca88 100644 --- a/src/lttngtop.c +++ b/src/lttngtop.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -194,8 +195,8 @@ void update_perf_value(struct processtop *proc, struct cputime *cpu, } } -void extract_perf_counter_scope(struct bt_ctf_event *event, - struct definition *scope, +void extract_perf_counter_scope(const struct bt_ctf_event *event, + const struct definition *scope, struct processtop *proc, struct cputime *cpu) { @@ -224,10 +225,10 @@ end: return; } -void update_perf_counter(struct processtop *proc, struct bt_ctf_event *event) +void update_perf_counter(struct processtop *proc, const struct bt_ctf_event *event) { struct cputime *cpu; - struct definition *scope; + const struct definition *scope; cpu = get_cpu(get_cpu_id(event)); @@ -384,7 +385,7 @@ void iter_trace(struct bt_context *bt_ctx) { struct bt_ctf_iter *iter; struct bt_iter_pos begin_pos; - struct bt_ctf_event *event; + const struct bt_ctf_event *event; int ret = 0; begin_pos.type = BT_SEEK_BEGIN;