Add const for most of the babeltrace APi calls
authorJulien Desfossez <julien.desfossez@efficios.com>
Tue, 13 Mar 2012 18:35:09 +0000 (14:35 -0400)
committerJulien Desfossez <julien.desfossez@efficios.com>
Tue, 13 Mar 2012 18:35:09 +0000 (14:35 -0400)
Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
src/common.c
src/common.h
src/cputop.c
src/iostreamtop.c
src/lttngtop.c

index ad190c918c753b5cace0ccb5d8bf7475bbc01426..df2ef7a4d376a395587815939dc224fa1926cab9 100644 (file)
@@ -20,9 +20,9 @@
 #include <string.h>
 #include "common.h"
 
 #include <string.h>
 #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);
        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;
 }
 
        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);
        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;
 }
 
        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);
        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;
 }
 
        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);
        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;
 }
 
        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);
        char *comm;
 
        scope = bt_ctf_get_top_level_scope(event, BT_STREAM_EVENT_CONTEXT);
index cfa68cd8aff95dc510071e7aa185ef64cfcd31d8..6370b77f30afe1bcd14fa71815ebbba2dc77ba47 100644 (file)
@@ -52,10 +52,10 @@ struct perfcounter *get_perf_counter(const char *name, struct processtop *proc,
                struct cputime *cpu);
 
 /* common field access functions */
                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 */
 
 #endif /* _COMMON_H */
index d652b5b43e5bff161e48886945fc05cb3982a7a3..c561d47205dd8af3ba8dc192f7da3652c0fe2369 100644 (file)
@@ -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)
 {
 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;
        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)
 {
 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;
        unsigned long timestamp;
        char *comm;
        int tid;
index c47926f80945f661f3d373ddc6b79fb153c4daf6..e3a643478d7e3608cbd54a071feb912c02879ef3 100644 (file)
@@ -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)
 {
 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;
        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)
 {
 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;
        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;
                void *private_data)
 {
        struct processtop *tmp;
-       struct definition *scope;
+       const struct definition *scope;
        unsigned long timestamp;
        uint64_t cpu_id;
        char *comm;
        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 processtop *tmp;
-       struct definition *scope;
+       const struct definition *scope;
        unsigned long timestamp;
        uint64_t cpu_id;
        char *comm;
        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)
 {
 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;
        unsigned long timestamp;
        int64_t tid;
        struct processtop *tmp;
index 95bd383e6d8b4f4b8f8d5c11cfe114b7f16b5052..cc0ca882c80b2e5a2ebf4064563df4506569564c 100644 (file)
@@ -22,6 +22,7 @@
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/ctf/events.h>
 #include <babeltrace/ctf/callbacks.h>
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/ctf/events.h>
 #include <babeltrace/ctf/callbacks.h>
+#include <babeltrace/ctf/iterator.h>
 #include <fcntl.h>
 #include <pthread.h>
 #include <popt.h>
 #include <fcntl.h>
 #include <pthread.h>
 #include <popt.h>
@@ -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)
 {
                struct processtop *proc,
                struct cputime *cpu)
 {
@@ -224,10 +225,10 @@ end:
        return;
 }
 
        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 cputime *cpu;
-       struct definition *scope;
+       const struct definition *scope;
 
        cpu = get_cpu(get_cpu_id(event));
 
 
        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_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;
        int ret = 0;
 
        begin_pos.type = BT_SEEK_BEGIN;
This page took 0.02679 seconds and 4 git commands to generate.