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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#ifndef _SYS_TRACE_H_
#define _SYS_TRACE_H_
#ifdef CONFIG_SCHED_OVERHEAD_TRACE
#include <litmus/feather_trace.h>
#include <litmus/feather_buffer.h>
/*********************** TIMESTAMPS ************************/
enum task_type_marker {
TSK_BE,
TSK_RT,
TSK_UNKNOWN
};
struct timestamp {
uint64_t timestamp;
uint32_t seq_no;
uint8_t cpu;
uint8_t event;
uint8_t task_type;
};
/* tracing callbacks */
feather_callback void save_timestamp(unsigned long event);
feather_callback void save_timestamp_def(unsigned long event, unsigned long type);
feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr);
feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu);
feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr);
#define TIMESTAMP(id) ft_event0(id, save_timestamp)
#define DTIMESTAMP(id, def) ft_event1(id, save_timestamp_def, (unsigned long) def)
#define TTIMESTAMP(id, task) \
ft_event1(id, save_timestamp_task, (unsigned long) task)
#define CTIMESTAMP(id, cpu) \
ft_event1(id, save_timestamp_cpu, (unsigned long) cpu)
#define LTIMESTAMP(id, task) \
ft_event1(id, save_task_latency, (unsigned long) task)
#else /* !CONFIG_SCHED_OVERHEAD_TRACE */
#define TIMESTAMP(id) /* no tracing */
#define DTIMESTAMP(id, def) /* no tracing */
#define TTIMESTAMP(id, task) /* no tracing */
#define CTIMESTAMP(id, cpu) /* no tracing */
#define LTIMESTAMP(id, when_ptr) /* no tracing */
#endif
/* Convention for timestamps
* =========================
*
* In order to process the trace files with a common tool, we use the following
* convention to measure execution times: The end time id of a code segment is
* always the next number after the start time event id.
*/
#define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only
* care
* about
* next */
#define TS_SCHED_END(t) TTIMESTAMP(101, t)
#define TS_SCHED2_START(t) TTIMESTAMP(102, t)
#define TS_SCHED2_END(t) TTIMESTAMP(103, t)
#define TS_CXS_START(t) TTIMESTAMP(104, t)
#define TS_CXS_END(t) TTIMESTAMP(105, t)
#define TS_RELEASE_START DTIMESTAMP(106, TSK_RT)
#define TS_RELEASE_END DTIMESTAMP(107, TSK_RT)
#define TS_TICK_START(t) TTIMESTAMP(110, t)
#define TS_TICK_END(t) TTIMESTAMP(111, t)
#define TS_PLUGIN_SCHED_START /* TIMESTAMP(120) */ /* currently unused */
#define TS_PLUGIN_SCHED_END /* TIMESTAMP(121) */
#define TS_PLUGIN_TICK_START /* TIMESTAMP(130) */
#define TS_PLUGIN_TICK_END /* TIMESTAMP(131) */
#define TS_ENTER_NP_START TIMESTAMP(140)
#define TS_ENTER_NP_END TIMESTAMP(141)
#define TS_EXIT_NP_START TIMESTAMP(150)
#define TS_EXIT_NP_END TIMESTAMP(151)
#define TS_LOCK_START TIMESTAMP(170)
#define TS_LOCK_SUSPEND TIMESTAMP(171)
#define TS_LOCK_RESUME TIMESTAMP(172)
#define TS_LOCK_END TIMESTAMP(173)
#define TS_UNLOCK_START TIMESTAMP(180)
#define TS_UNLOCK_END TIMESTAMP(181)
#define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c)
#define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN)
#define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when))
#endif /* !_SYS_TRACE_H_ */
|