merge libmarkers, libtracing and libtracectl in a single libust library
[lttng-ust.git] / libust / tracercore.h
1 /*
2 * Copyright (C) 2005,2006 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
3 *
4 * This contains the core definitions for the Linux Trace Toolkit.
5 */
6
7 #ifndef LTT_CORE_H
8 #define LTT_CORE_H
9
10 #include "list.h"
11 #include "kernelcompat.h"
12 //ust// #include <linux/percpu.h>
13
14 /* ltt's root dir in debugfs */
15 #define LTT_ROOT "ltt"
16
17 /*
18 * All modifications of ltt_traces must be done by ltt-tracer.c, while holding
19 * the semaphore. Only reading of this information can be done elsewhere, with
20 * the RCU mechanism : the preemption must be disabled while reading the
21 * list.
22 */
23 struct ltt_traces {
24 struct list_head setup_head; /* Pre-allocated traces list */
25 struct list_head head; /* Allocated Traces list */
26 unsigned int num_active_traces; /* Number of active traces */
27 } ____cacheline_aligned;
28
29 extern struct ltt_traces ltt_traces;
30
31 /*
32 * get dentry of ltt's root dir
33 */
34 struct dentry *get_ltt_root(void);
35
36 /* Keep track of trap nesting inside LTT */
37 //ust// DECLARE_PER_CPU(unsigned int, ltt_nesting);
38 extern unsigned int ltt_nesting;
39
40 typedef int (*ltt_run_filter_functor)(void *trace, uint16_t eID);
41 //typedef int (*ltt_run_filter_functor)(void *, __u16);
42
43 extern ltt_run_filter_functor ltt_run_filter;
44
45 extern void ltt_filter_register(ltt_run_filter_functor func);
46 extern void ltt_filter_unregister(void);
47
48 #if defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT)
49
50 /*
51 * Calculate the offset needed to align the type.
52 * size_of_type must be non-zero.
53 */
54 static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type)
55 {
56 size_t alignment = min(sizeof(void *), size_of_type);
57 return (alignment - align_drift) & (alignment - 1);
58 }
59 /* Default arch alignment */
60 #define LTT_ALIGN
61
62 static inline int ltt_get_alignment(void)
63 {
64 return sizeof(void *);
65 }
66
67 #else
68
69 static inline unsigned int ltt_align(size_t align_drift,
70 size_t size_of_type)
71 {
72 return 0;
73 }
74
75 #define LTT_ALIGN __attribute__((packed))
76
77 static inline int ltt_get_alignment(void)
78 {
79 return 0;
80 }
81 #endif /* defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT) */
82
83 #endif /* LTT_CORE_H */
This page took 0.030363 seconds and 4 git commands to generate.