diff options
Diffstat (limited to 'include/litmus/feather_trace.h')
-rw-r--r-- | include/litmus/feather_trace.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/litmus/feather_trace.h b/include/litmus/feather_trace.h new file mode 100644 index 000000000000..7d27e763406f --- /dev/null +++ b/include/litmus/feather_trace.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _FEATHER_TRACE_H_ | ||
2 | #define _FEATHER_TRACE_H_ | ||
3 | |||
4 | #include <asm/atomic.h> | ||
5 | #include <asm/feather_trace.h> | ||
6 | |||
7 | int ft_enable_event(unsigned long id); | ||
8 | int ft_disable_event(unsigned long id); | ||
9 | int ft_is_event_enabled(unsigned long id); | ||
10 | int ft_disable_all_events(void); | ||
11 | |||
12 | /* atomic_* funcitons are inline anyway */ | ||
13 | static inline int fetch_and_inc(int *val) | ||
14 | { | ||
15 | return atomic_add_return(1, (atomic_t*) val) - 1; | ||
16 | } | ||
17 | |||
18 | static inline int fetch_and_dec(int *val) | ||
19 | { | ||
20 | return atomic_sub_return(1, (atomic_t*) val) + 1; | ||
21 | } | ||
22 | |||
23 | #ifndef __ARCH_HAS_FEATHER_TRACE | ||
24 | /* provide default implementation */ | ||
25 | |||
26 | #define feather_callback | ||
27 | |||
28 | #define MAX_EVENTS 1024 | ||
29 | |||
30 | extern int ft_events[MAX_EVENTS]; | ||
31 | |||
32 | #define ft_event(id, callback) \ | ||
33 | if (ft_events[id]) callback(); | ||
34 | |||
35 | #define ft_event0(id, callback) \ | ||
36 | if (ft_events[id]) callback(id); | ||
37 | |||
38 | #define ft_event1(id, callback, param) \ | ||
39 | if (ft_events[id]) callback(id, param); | ||
40 | |||
41 | #define ft_event2(id, callback, param, param2) \ | ||
42 | if (ft_events[id]) callback(id, param, param2); | ||
43 | |||
44 | #define ft_event3(id, callback, p, p2, p3) \ | ||
45 | if (ft_events[id]) callback(id, p, p2, p3); | ||
46 | |||
47 | #endif | ||
48 | |||
49 | #endif | ||