Commit | Line | Data |
---|---|---|
183646e6 PMF |
1 | /* |
2 | * Copyright (C) 2005,2006 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) | |
3 | * | |
4 | * This contains the core definitions for the Linux Trace Toolkit. | |
8fc2d8db PMF |
5 | * |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
183646e6 PMF |
19 | */ |
20 | ||
21 | #ifndef LTT_CORE_H | |
22 | #define LTT_CORE_H | |
23 | ||
b6bf28ec | 24 | #include "kernelcompat.h" |
183646e6 PMF |
25 | //ust// #include <linux/percpu.h> |
26 | ||
27 | /* ltt's root dir in debugfs */ | |
28 | #define LTT_ROOT "ltt" | |
29 | ||
30 | /* | |
31 | * All modifications of ltt_traces must be done by ltt-tracer.c, while holding | |
32 | * the semaphore. Only reading of this information can be done elsewhere, with | |
33 | * the RCU mechanism : the preemption must be disabled while reading the | |
34 | * list. | |
35 | */ | |
36 | struct ltt_traces { | |
37 | struct list_head setup_head; /* Pre-allocated traces list */ | |
38 | struct list_head head; /* Allocated Traces list */ | |
39 | unsigned int num_active_traces; /* Number of active traces */ | |
40 | } ____cacheline_aligned; | |
41 | ||
42 | extern struct ltt_traces ltt_traces; | |
43 | ||
44 | /* | |
45 | * get dentry of ltt's root dir | |
46 | */ | |
47 | struct dentry *get_ltt_root(void); | |
48 | ||
49 | /* Keep track of trap nesting inside LTT */ | |
50 | //ust// DECLARE_PER_CPU(unsigned int, ltt_nesting); | |
bb07823d | 51 | extern unsigned int ltt_nesting; |
183646e6 PMF |
52 | |
53 | typedef int (*ltt_run_filter_functor)(void *trace, uint16_t eID); | |
1ae7f074 | 54 | //typedef int (*ltt_run_filter_functor)(void *, __u16); |
183646e6 PMF |
55 | |
56 | extern ltt_run_filter_functor ltt_run_filter; | |
57 | ||
58 | extern void ltt_filter_register(ltt_run_filter_functor func); | |
59 | extern void ltt_filter_unregister(void); | |
60 | ||
61 | #if defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT) | |
62 | ||
63 | /* | |
64 | * Calculate the offset needed to align the type. | |
65 | * size_of_type must be non-zero. | |
66 | */ | |
67 | static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type) | |
68 | { | |
69 | size_t alignment = min(sizeof(void *), size_of_type); | |
70 | return (alignment - align_drift) & (alignment - 1); | |
71 | } | |
72 | /* Default arch alignment */ | |
73 | #define LTT_ALIGN | |
74 | ||
75 | static inline int ltt_get_alignment(void) | |
76 | { | |
77 | return sizeof(void *); | |
78 | } | |
79 | ||
80 | #else | |
81 | ||
82 | static inline unsigned int ltt_align(size_t align_drift, | |
83 | size_t size_of_type) | |
84 | { | |
85 | return 0; | |
86 | } | |
87 | ||
88 | #define LTT_ALIGN __attribute__((packed)) | |
89 | ||
90 | static inline int ltt_get_alignment(void) | |
91 | { | |
92 | return 0; | |
93 | } | |
94 | #endif /* defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT) */ | |
95 | ||
96 | #endif /* LTT_CORE_H */ |