filtering in GUI working
[lttngtop.git] / src / common.h
1 /*
2 * Copyright (C) 2011-2012 Julien Desfossez
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef _COMMON_H
19 #define _COMMON_H
20
21 #include <semaphore.h>
22 #include <babeltrace/ctf/events.h>
23 #include "lttngtoptypes.h"
24 #include "cputop.h"
25
26 #define NSEC_PER_USEC 1000
27 #define NSEC_PER_SEC 1000000000L
28
29 sem_t goodtodisplay, goodtoupdate, timer, pause_sem, end_trace_sem, bootstrap;
30
31 GPtrArray *copies; /* struct lttngtop */
32 GHashTable *global_perf_liszt;
33 GHashTable *global_filter_list;
34
35 char *opt_tid;
36 char *opt_hostname;
37 char *opt_kprobes;
38 GHashTable *tid_list;
39 GHashTable *hostname_list;
40
41 int toggle_filter;
42
43 extern int quit;
44
45 struct lttngtop *data;
46
47 struct processtop *find_process_tid(struct lttngtop *ctx, int pid, char *comm);
48 struct processtop* add_proc(struct lttngtop *ctx, int pid, char *comm,
49 unsigned long timestamp);
50 struct processtop* update_proc(struct processtop* proc, int pid, int tid,
51 int ppid, int vpid, int vtid, int vppid, char *comm,
52 char *hostname);
53 void add_thread(struct processtop *parent, struct processtop *thread);
54 struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm,
55 unsigned long timestamp);
56
57 struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid,
58 unsigned long timestamp);
59
60 void death_proc(struct lttngtop *ctx, int tid, char *comm,
61 unsigned long timestamp);
62 struct cputime* add_cpu(int cpu);
63 struct cputime* get_cpu(int cpu);
64 struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end);
65 struct perfcounter *add_perf_counter(GPtrArray *perf, GQuark quark,
66 unsigned long count);
67 struct perfcounter *get_perf_counter(const char *name, struct processtop *proc,
68 struct cputime *cpu);
69 void reset_global_counters(void);
70
71 /* common field access functions */
72 uint64_t get_cpu_id(const struct bt_ctf_event *event);
73 uint64_t get_context_tid(const struct bt_ctf_event *event);
74 uint64_t get_context_pid(const struct bt_ctf_event *event);
75 uint64_t get_context_ppid(const struct bt_ctf_event *event);
76 char *get_context_comm(const struct bt_ctf_event *event);
77 uint64_t get_context_vtid(const struct bt_ctf_event *event);
78 uint64_t get_context_vpid(const struct bt_ctf_event *event);
79 uint64_t get_context_vppid(const struct bt_ctf_event *event);
80 char *get_context_hostname(const struct bt_ctf_event *event);
81
82 enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data,
83 void *private_data);
84
85 struct tm format_timestamp(uint64_t timestamp);
86
87 int *lookup_filter_tid_list(int tid);
88 int *lookup_tid_list(int tid);
89 char *lookup_hostname_list(const char *hostname);
90 void add_filter_tid_list(int tid, struct processtop *newproc);
91 void remove_filter_tid_list(int tid);
92
93 #endif /* _COMMON_H */
This page took 0.032236 seconds and 5 git commands to generate.