Commit | Line | Data |
---|---|---|
1fc22eb4 | 1 | /* |
aa15ac1c | 2 | * Copyright (C) 2011-2012 Julien Desfossez |
1fc22eb4 JD |
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 | * | |
71bd7ce1 AM |
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. | |
1fc22eb4 JD |
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 */ | |
0d91c12a | 32 | GHashTable *global_perf_liszt; |
da4353bb | 33 | GHashTable *global_filter_list; |
114cae59 | 34 | GHashTable *global_host_list; |
1fc22eb4 | 35 | |
57bff788 | 36 | char *opt_tid; |
c8d75a13 | 37 | char *opt_hostname; |
b1acd2b3 | 38 | char *opt_relay_hostname; |
f16e36fc | 39 | char *opt_kprobes; |
54761a45 JD |
40 | char *opt_exec_name; |
41 | char **opt_exec_argv; | |
42 | char **opt_exec_env; | |
43 | int opt_exec_pid; | |
09e7f98e JD |
44 | char *opt_output; |
45 | FILE *output; | |
ea5d1dc9 | 46 | GHashTable *tid_filter_list; |
96aa77de | 47 | |
b1acd2b3 JD |
48 | int remote_live; |
49 | ||
da4353bb JD |
50 | int toggle_filter; |
51 | ||
ae9e85c7 JD |
52 | extern int quit; |
53 | ||
1fc22eb4 JD |
54 | struct lttngtop *data; |
55 | ||
08d1cfbe | 56 | struct processtop *find_process_tid(struct lttngtop *ctx, int pid, const char *comm); |
1fc22eb4 | 57 | struct processtop* add_proc(struct lttngtop *ctx, int pid, char *comm, |
906c08f6 | 58 | unsigned long timestamp, char *hostname); |
1fc22eb4 | 59 | struct processtop* update_proc(struct processtop* proc, int pid, int tid, |
c8d75a13 JD |
60 | int ppid, int vpid, int vtid, int vppid, char *comm, |
61 | char *hostname); | |
1fc22eb4 JD |
62 | void add_thread(struct processtop *parent, struct processtop *thread); |
63 | struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm, | |
906c08f6 | 64 | unsigned long timestamp, char *hostname); |
59288610 MB |
65 | |
66 | struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid, | |
906c08f6 | 67 | unsigned long timestamp, char *hostname); |
59288610 | 68 | |
1fc22eb4 JD |
69 | void death_proc(struct lttngtop *ctx, int tid, char *comm, |
70 | unsigned long timestamp); | |
71 | struct cputime* add_cpu(int cpu); | |
72 | struct cputime* get_cpu(int cpu); | |
73 | struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end); | |
74 | struct perfcounter *add_perf_counter(GPtrArray *perf, GQuark quark, | |
75 | unsigned long count); | |
76 | struct perfcounter *get_perf_counter(const char *name, struct processtop *proc, | |
77 | struct cputime *cpu); | |
e05a35a6 | 78 | void reset_global_counters(void); |
1fc22eb4 | 79 | |
d67167cd | 80 | /* common field access functions */ |
4adc8274 JD |
81 | uint64_t get_cpu_id(const struct bt_ctf_event *event); |
82 | uint64_t get_context_tid(const struct bt_ctf_event *event); | |
83 | uint64_t get_context_pid(const struct bt_ctf_event *event); | |
84 | uint64_t get_context_ppid(const struct bt_ctf_event *event); | |
85 | char *get_context_comm(const struct bt_ctf_event *event); | |
1402044a JD |
86 | uint64_t get_context_vtid(const struct bt_ctf_event *event); |
87 | uint64_t get_context_vpid(const struct bt_ctf_event *event); | |
88 | uint64_t get_context_vppid(const struct bt_ctf_event *event); | |
c8d75a13 | 89 | char *get_context_hostname(const struct bt_ctf_event *event); |
d67167cd | 90 | |
928f18a6 MB |
91 | enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data, |
92 | void *private_data); | |
93 | ||
b520ab45 JD |
94 | struct tm format_timestamp(uint64_t timestamp); |
95 | ||
da4353bb | 96 | int *lookup_filter_tid_list(int tid); |
57bff788 | 97 | int *lookup_tid_list(int tid); |
906c08f6 | 98 | void remove_hostname_list(const char *hostname); |
b99227ca | 99 | void add_filter_tid_list(struct processtop *proc); |
da4353bb | 100 | void remove_filter_tid_list(int tid); |
114cae59 JD |
101 | struct host *lookup_hostname_list(const char *hostname); |
102 | int is_hostname_filtered(const char *hostname); | |
b99227ca JD |
103 | struct host *add_hostname_list(char *hostname, int filter); |
104 | void update_hostname_filter(struct host *host); | |
57bff788 | 105 | |
1fc22eb4 | 106 | #endif /* _COMMON_H */ |