#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);
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);
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);
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);
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);
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 */
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;
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;
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;
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;
void *private_data)
{
struct processtop *tmp;
- struct definition *scope;
+ const struct definition *scope;
unsigned long timestamp;
uint64_t cpu_id;
char *comm;
{
struct processtop *tmp;
- struct definition *scope;
+ const struct definition *scope;
unsigned long timestamp;
uint64_t cpu_id;
char *comm;
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;
#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>
}
}
-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)
{
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));
{
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;