| 1 | /* |
| 2 | * Copyright (C) 2011 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 |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _COMMON_H |
| 20 | #define _COMMON_H |
| 21 | |
| 22 | #include <semaphore.h> |
| 23 | #include <babeltrace/ctf/events.h> |
| 24 | #include "lttngtoptypes.h" |
| 25 | #include "cputop.h" |
| 26 | |
| 27 | #define NSEC_PER_USEC 1000 |
| 28 | #define NSEC_PER_SEC 1000000000L |
| 29 | |
| 30 | sem_t goodtodisplay, goodtoupdate, timer, pause_sem, end_trace_sem, bootstrap; |
| 31 | |
| 32 | GPtrArray *copies; /* struct lttngtop */ |
| 33 | pthread_mutex_t perf_list_mutex; |
| 34 | |
| 35 | struct lttngtop *data; |
| 36 | |
| 37 | struct processtop *find_process_tid(struct lttngtop *ctx, int pid, char *comm); |
| 38 | struct processtop* add_proc(struct lttngtop *ctx, int pid, char *comm, |
| 39 | unsigned long timestamp); |
| 40 | struct processtop* update_proc(struct processtop* proc, int pid, int tid, |
| 41 | int ppid, char *comm); |
| 42 | void add_thread(struct processtop *parent, struct processtop *thread); |
| 43 | struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm, |
| 44 | unsigned long timestamp); |
| 45 | void death_proc(struct lttngtop *ctx, int tid, char *comm, |
| 46 | unsigned long timestamp); |
| 47 | struct cputime* add_cpu(int cpu); |
| 48 | struct cputime* get_cpu(int cpu); |
| 49 | struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end); |
| 50 | struct perfcounter *add_perf_counter(GPtrArray *perf, GQuark quark, |
| 51 | unsigned long count); |
| 52 | struct perfcounter *get_perf_counter(const char *name, struct processtop *proc, |
| 53 | struct cputime *cpu); |
| 54 | |
| 55 | #endif /* _COMMON_H */ |