2 * Copyright (C) 2011 Julien Desfossez
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;
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.
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.
21 #include <semaphore.h>
22 #include <babeltrace/ctf/events.h>
23 #include "lttngtoptypes.h"
26 #define NSEC_PER_USEC 1000
27 #define NSEC_PER_SEC 1000000000L
29 sem_t goodtodisplay
, goodtoupdate
, timer
, pause_sem
, end_trace_sem
, bootstrap
;
31 GPtrArray
*copies
; /* struct lttngtop */
32 pthread_mutex_t perf_list_mutex
;
34 struct lttngtop
*data
;
36 struct processtop
*find_process_tid(struct lttngtop
*ctx
, int pid
, char *comm
);
37 struct processtop
* add_proc(struct lttngtop
*ctx
, int pid
, char *comm
,
38 unsigned long timestamp
);
39 struct processtop
* update_proc(struct processtop
* proc
, int pid
, int tid
,
40 int ppid
, char *comm
);
41 void add_thread(struct processtop
*parent
, struct processtop
*thread
);
42 struct processtop
* get_proc(struct lttngtop
*ctx
, int tid
, char *comm
,
43 unsigned long timestamp
);
45 struct processtop
*get_proc_pid(struct lttngtop
*ctx
, int tid
, int pid
,
46 unsigned long timestamp
);
48 void death_proc(struct lttngtop
*ctx
, int tid
, char *comm
,
49 unsigned long timestamp
);
50 struct cputime
* add_cpu(int cpu
);
51 struct cputime
* get_cpu(int cpu
);
52 struct lttngtop
* get_copy_lttngtop(unsigned long start
, unsigned long end
);
53 struct perfcounter
*add_perf_counter(GPtrArray
*perf
, GQuark quark
,
55 struct perfcounter
*get_perf_counter(const char *name
, struct processtop
*proc
,
57 void reset_global_counters(void);
59 /* common field access functions */
60 uint64_t get_cpu_id(const struct bt_ctf_event
*event
);
61 uint64_t get_context_tid(const struct bt_ctf_event
*event
);
62 uint64_t get_context_pid(const struct bt_ctf_event
*event
);
63 uint64_t get_context_ppid(const struct bt_ctf_event
*event
);
64 char *get_context_comm(const struct bt_ctf_event
*event
);
66 enum bt_cb_ret
handle_statedump_process_state(struct bt_ctf_event
*call_data
,
69 #endif /* _COMMON_H */