#include <string.h>
#include "common.h"
-uint64_t get_cpu_id(const struct bt_ctf_event *event)
+uint64_t get_cpu_id(const struct ctf_event_definition *event)
{
const struct definition *scope;
uint64_t cpu_id;
return cpu_id;
}
-uint64_t get_context_tid(const struct bt_ctf_event *event)
+uint64_t get_context_tid(const struct ctf_event_definition *event)
{
const struct definition *scope;
uint64_t tid;
return tid;
}
-uint64_t get_context_pid(const struct bt_ctf_event *event)
+uint64_t get_context_pid(const struct ctf_event_definition *event)
{
const struct definition *scope;
uint64_t pid;
return pid;
}
-uint64_t get_context_ppid(const struct bt_ctf_event *event)
+uint64_t get_context_ppid(const struct ctf_event_definition *event)
{
const struct definition *scope;
uint64_t ppid;
return ppid;
}
-char *get_context_comm(const struct bt_ctf_event *event)
+char *get_context_comm(const struct ctf_event_definition *event)
{
const struct definition *scope;
char *comm;
return comm;
}
+/*
+ * To get the parent process, put the pid in the tid field
+ * because the parent process gets pid = tid
+ *
+ * FIXME : char *comm useful ???
+ */
struct processtop *find_process_tid(struct lttngtop *ctx, int tid, char *comm)
{
gint i;
newproc->fileread = 0;
newproc->filewrite = 0;
newproc->syscall_info = NULL;
+ newproc->threadparent = NULL;
newproc->threads = g_ptr_array_new();
newproc->perf = g_hash_table_new(g_str_hash, g_str_equal);
g_ptr_array_add(ctx->process_table, newproc);
return add_proc(ctx, tid, comm, timestamp);
}
+struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid,
+ unsigned long timestamp)
+{
+ struct processtop *tmp;
+ tmp = find_process_tid(ctx, tid, NULL);
+ if (tmp && tmp->pid == pid)
+ return tmp;
+ return add_proc(ctx, tid, "Unknown", timestamp);
+}
+
void add_thread(struct processtop *parent, struct processtop *thread)
{
gint i;
void copy_perf_counter(gpointer key, gpointer value, gpointer new_table)
{
struct perfcounter *newperf;
-
+
newperf = g_new0(struct perfcounter, 1);
newperf->count = ((struct perfcounter *) value)->count;
newperf->visible = ((struct perfcounter *) value)->visible;
* the current process list after the copy
*/
if (tmp->death > 0 && tmp->death < end) {
- fprintf(stderr, "removing : %ld : %d %s\n", end, tmp->tid, tmp->comm);
g_ptr_array_remove(lttngtop.process_table, tmp);
/* FIXME : TRUE does not mean clears the object in it */
g_ptr_array_free(tmp->threads, TRUE);