add output file redirection and debug verbose option
[lttngtop.git] / src / common.h
... / ...
CommitLineData
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
29sem_t goodtodisplay, goodtoupdate, timer, pause_sem, end_trace_sem, bootstrap;
30
31GPtrArray *copies; /* struct lttngtop */
32GHashTable *global_perf_liszt;
33GHashTable *global_filter_list;
34GHashTable *global_host_list;
35
36char *opt_tid;
37char *opt_hostname;
38char *opt_relay_hostname;
39char *opt_kprobes;
40char *opt_exec_name;
41char **opt_exec_argv;
42char **opt_exec_env;
43int opt_exec_pid;
44char *opt_output;
45FILE *output;
46GHashTable *tid_filter_list;
47
48int remote_live;
49
50int toggle_filter;
51
52extern int quit;
53
54struct lttngtop *data;
55
56struct processtop *find_process_tid(struct lttngtop *ctx, int pid, const char *comm);
57struct processtop* add_proc(struct lttngtop *ctx, int pid, char *comm,
58 unsigned long timestamp, char *hostname);
59struct processtop* update_proc(struct processtop* proc, int pid, int tid,
60 int ppid, int vpid, int vtid, int vppid, char *comm,
61 char *hostname);
62void add_thread(struct processtop *parent, struct processtop *thread);
63struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm,
64 unsigned long timestamp, char *hostname);
65
66struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid,
67 unsigned long timestamp, char *hostname);
68
69void death_proc(struct lttngtop *ctx, int tid, char *comm,
70 unsigned long timestamp);
71struct cputime* add_cpu(int cpu);
72struct cputime* get_cpu(int cpu);
73struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end);
74struct perfcounter *add_perf_counter(GPtrArray *perf, GQuark quark,
75 unsigned long count);
76struct perfcounter *get_perf_counter(const char *name, struct processtop *proc,
77 struct cputime *cpu);
78void reset_global_counters(void);
79
80/* common field access functions */
81uint64_t get_cpu_id(const struct bt_ctf_event *event);
82uint64_t get_context_tid(const struct bt_ctf_event *event);
83uint64_t get_context_pid(const struct bt_ctf_event *event);
84uint64_t get_context_ppid(const struct bt_ctf_event *event);
85char *get_context_comm(const struct bt_ctf_event *event);
86uint64_t get_context_vtid(const struct bt_ctf_event *event);
87uint64_t get_context_vpid(const struct bt_ctf_event *event);
88uint64_t get_context_vppid(const struct bt_ctf_event *event);
89char *get_context_hostname(const struct bt_ctf_event *event);
90
91enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data,
92 void *private_data);
93
94struct tm format_timestamp(uint64_t timestamp);
95
96int *lookup_filter_tid_list(int tid);
97int *lookup_tid_list(int tid);
98void remove_hostname_list(const char *hostname);
99void add_filter_tid_list(struct processtop *proc);
100void remove_filter_tid_list(int tid);
101struct host *lookup_hostname_list(const char *hostname);
102int is_hostname_filtered(const char *hostname);
103struct host *add_hostname_list(char *hostname, int filter);
104void update_hostname_filter(struct host *host);
105
106#endif /* _COMMON_H */
This page took 0.021655 seconds and 4 git commands to generate.