aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/ft_event.c
blob: dbf61f6c389a004438490aa97c7cfa9ae0336554 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <linux/types.h>

#include <litmus/feather_trace.h>

#if !defined(CONFIG_ARCH_HAS_FEATHER_TRACE) || defined(CONFIG_RELOCATABLE)
/* provide dummy implementation */

int ft_events[MAX_EVENTS];

int ft_enable_event(unsigned long id)
{
	if (id < MAX_EVENTS) {
		ft_events[id]++;
		return 1;
	} else
		return 0;
}

int ft_disable_event(unsigned long id)
{
	if (id < MAX_EVENTS && ft_events[id]) {
		ft_events[id]--;
		return 1;
	} else
		return 0;
}

int ft_disable_all_events(void)
{
	int i;

	for (i = 0; i < MAX_EVENTS; i++)
		ft_events[i] = 0;

	return MAX_EVENTS;
}

int ft_is_event_enabled(unsigned long id)
{
	return 	id < MAX_EVENTS && ft_events[id];
}

#endif