aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/feather_trace.h
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 07:18:44 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-08-09 06:21:15 -0400
commit5459c945fd381af0c587a04a7d8d468fa348257d (patch)
tree9a0804b412623bdbd16235f14cd0e4ab48f24c02 /include/litmus/feather_trace.h
parent6c10dcd2d019bb63026f1fdbd158788cdf7b8b0a (diff)
Feather-Trace: add platform independent implementation
This patch adds the simple fallback implementation and creates dummy hooks in the x86 and ARM Kconfig files.
Diffstat (limited to 'include/litmus/feather_trace.h')
-rw-r--r--include/litmus/feather_trace.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/include/litmus/feather_trace.h b/include/litmus/feather_trace.h
new file mode 100644
index 000000000000..dbeca46c01f5
--- /dev/null
+++ b/include/litmus/feather_trace.h
@@ -0,0 +1,69 @@
1#ifndef _FEATHER_TRACE_H_
2#define _FEATHER_TRACE_H_
3
4#include <asm/atomic.h>
5
6int ft_enable_event(unsigned long id);
7int ft_disable_event(unsigned long id);
8int ft_is_event_enabled(unsigned long id);
9int ft_disable_all_events(void);
10
11/* atomic_* funcitons are inline anyway */
12static inline int fetch_and_inc(int *val)
13{
14 return atomic_add_return(1, (atomic_t*) val) - 1;
15}
16
17static inline int fetch_and_dec(int *val)
18{
19 return atomic_sub_return(1, (atomic_t*) val) + 1;
20}
21
22static inline void ft_atomic_dec(int *val)
23{
24 atomic_sub(1, (atomic_t*) val);
25}
26
27/* Don't use rewriting implementation if kernel text pages are read-only.
28 * Ftrace gets around this by using the identity mapping, but that's more
29 * effort that is warrented right now for Feather-Trace.
30 * Eventually, it may make sense to replace Feather-Trace with ftrace.
31 */
32#if defined(CONFIG_ARCH_HAS_FEATHER_TRACE) && !defined(CONFIG_DEBUG_RODATA)
33
34#include <asm/feather_trace.h>
35
36#else /* !__ARCH_HAS_FEATHER_TRACE */
37
38/* provide default implementation */
39#include <linux/timex.h> /* for get_cycles() */
40
41static inline unsigned long long ft_timestamp(void)
42{
43 return get_cycles();
44}
45
46#define feather_callback
47
48#define MAX_EVENTS 1024
49
50extern int ft_events[MAX_EVENTS];
51
52#define ft_event(id, callback) \
53 if (ft_events[id]) callback();
54
55#define ft_event0(id, callback) \
56 if (ft_events[id]) callback(id);
57
58#define ft_event1(id, callback, param) \
59 if (ft_events[id]) callback(id, param);
60
61#define ft_event2(id, callback, param, param2) \
62 if (ft_events[id]) callback(id, param, param2);
63
64#define ft_event3(id, callback, p, p2, p3) \
65 if (ft_events[id]) callback(id, p, p2, p3);
66
67#endif /* __ARCH_HAS_FEATHER_TRACE */
68
69#endif