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; |
1fc22eb4 | 33 | |
ae9e85c7 JD |
34 | extern int quit; |
35 | ||
1fc22eb4 JD |
36 | struct lttngtop *data; |
37 | ||
38 | struct processtop *find_process_tid(struct lttngtop *ctx, int pid, char *comm); | |
39 | struct processtop* add_proc(struct lttngtop *ctx, int pid, char *comm, | |
40 | unsigned long timestamp); | |
41 | struct processtop* update_proc(struct processtop* proc, int pid, int tid, | |
1402044a | 42 | int ppid, int vpid, int vtid, int vppid, char *comm); |
1fc22eb4 JD |
43 | void add_thread(struct processtop *parent, struct processtop *thread); |
44 | struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm, | |
45 | unsigned long timestamp); | |
59288610 MB |
46 | |
47 | struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid, | |
48 | unsigned long timestamp); | |
49 | ||
1fc22eb4 JD |
50 | void death_proc(struct lttngtop *ctx, int tid, char *comm, |
51 | unsigned long timestamp); | |
52 | struct cputime* add_cpu(int cpu); | |
53 | struct cputime* get_cpu(int cpu); | |
54 | struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end); | |
55 | struct perfcounter *add_perf_counter(GPtrArray *perf, GQuark quark, | |
56 | unsigned long count); | |
57 | struct perfcounter *get_perf_counter(const char *name, struct processtop *proc, | |
58 | struct cputime *cpu); | |
e05a35a6 | 59 | void reset_global_counters(void); |
1fc22eb4 | 60 | |
d67167cd | 61 | /* common field access functions */ |
4adc8274 JD |
62 | uint64_t get_cpu_id(const struct bt_ctf_event *event); |
63 | uint64_t get_context_tid(const struct bt_ctf_event *event); | |
64 | uint64_t get_context_pid(const struct bt_ctf_event *event); | |
65 | uint64_t get_context_ppid(const struct bt_ctf_event *event); | |
66 | char *get_context_comm(const struct bt_ctf_event *event); | |
1402044a JD |
67 | uint64_t get_context_vtid(const struct bt_ctf_event *event); |
68 | uint64_t get_context_vpid(const struct bt_ctf_event *event); | |
69 | uint64_t get_context_vppid(const struct bt_ctf_event *event); | |
d67167cd | 70 | |
928f18a6 MB |
71 | enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data, |
72 | void *private_data); | |
73 | ||
b520ab45 JD |
74 | struct tm format_timestamp(uint64_t timestamp); |
75 | ||
1fc22eb4 | 76 | #endif /* _COMMON_H */ |