| 1 | |
| 2 | /* LTTng user-space "fast" tracing header |
| 3 | * |
| 4 | * Copyright 2006 Mathieu Desnoyers |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTT_USERTRACE_FAST_H |
| 9 | #define _LTT_USERTRACE_FAST_H |
| 10 | |
| 11 | #include <errno.h> |
| 12 | #include <asm/atomic.h> |
| 13 | #include <pthread.h> |
| 14 | |
| 15 | #ifndef LTT_BUF_SIZE_CPU |
| 16 | #define LTT_BUF_SIZE_CPU 1048576 |
| 17 | #endif //LTT_BUF_SIZE_CPU |
| 18 | |
| 19 | #ifndef LTT_BUF_SIZE_FACILITIES |
| 20 | #define LTT_BUF_SIZE_FACILITIES 4096 |
| 21 | #endif //LTT_BUF_SIZE_FACILITIES |
| 22 | |
| 23 | struct ltt_buf { |
| 24 | atomic_t offset; |
| 25 | atomic_t reserve_count; |
| 26 | atomic_t commit_count; |
| 27 | |
| 28 | atomic_t events_lost; |
| 29 | }; |
| 30 | |
| 31 | struct ltt_trace_info { |
| 32 | int init; |
| 33 | int filter; |
| 34 | #ifndef LTT_USE_THREADS |
| 35 | pid_t daemon_id; |
| 36 | #else |
| 37 | pthread_t daemon_id; |
| 38 | #endif //LTT_USE_THREADS |
| 39 | atomic_t nesting; |
| 40 | struct { |
| 41 | struct ltt_buf facilities; |
| 42 | struct ltt_buf cpu; |
| 43 | char facilities_buf[LTT_BUF_SIZE_FACILITIES] __attribute__ ((aligned (8))); |
| 44 | char cpu_buf[LTT_BUF_SIZE_CPU] __attribute__ ((aligned (8))); |
| 45 | } channel; |
| 46 | }; |
| 47 | |
| 48 | extern __thread struct ltt_trace_info *thread_trace_info; |
| 49 | |
| 50 | void ltt_thread_init(void); |
| 51 | |
| 52 | void ltt_usertrace_fast_buffer_switch(void); |
| 53 | |
| 54 | #endif //_LTT_USERTRACE_FAST_H |