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