diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-15 07:13:08 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-10-18 16:14:02 -0400 |
commit | 5454446ed47708b26d40337e47affea5e1f298ef (patch) | |
tree | d76e1b681cf2291bf8d9269dd6820bd086ca5db8 | |
parent | 7b84800f5ee2e35671ac08a7d281ac7f0069ce8f (diff) |
Feather-Trace: update locking timestamps
Reassing locking timestamps and prepare support for tracing
system call overheads.
-rw-r--r-- | include/litmus/trace.h | 32 | ||||
-rw-r--r-- | litmus/locking.c | 2 | ||||
-rw-r--r-- | litmus/trace.c | 21 |
3 files changed, 47 insertions, 8 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 7efced0c3078..ee55c2eca482 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_SCHED_OVERHEAD_TRACE | 4 | #ifdef CONFIG_SCHED_OVERHEAD_TRACE |
5 | 5 | ||
6 | |||
6 | #include <litmus/feather_trace.h> | 7 | #include <litmus/feather_trace.h> |
7 | #include <litmus/feather_buffer.h> | 8 | #include <litmus/feather_buffer.h> |
8 | 9 | ||
@@ -32,11 +33,14 @@ feather_callback void save_timestamp_def(unsigned long event, unsigned long type | |||
32 | feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr); | 33 | feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr); |
33 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); | 34 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); |
34 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); | 35 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); |
36 | feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); | ||
35 | 37 | ||
36 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) | 38 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) |
37 | 39 | ||
38 | #define DTIMESTAMP(id, def) ft_event1(id, save_timestamp_def, (unsigned long) def) | 40 | #define DTIMESTAMP(id, def) ft_event1(id, save_timestamp_def, (unsigned long) def) |
39 | 41 | ||
42 | #define TIMESTAMP_CUR(id) DTIMESTAMP(id, is_realtime(current) ? TSK_RT : TSK_BE) | ||
43 | |||
40 | #define TTIMESTAMP(id, task) \ | 44 | #define TTIMESTAMP(id, task) \ |
41 | ft_event1(id, save_timestamp_task, (unsigned long) task) | 45 | ft_event1(id, save_timestamp_task, (unsigned long) task) |
42 | 46 | ||
@@ -46,18 +50,25 @@ feather_callback void save_task_latency(unsigned long event, unsigned long when_ | |||
46 | #define LTIMESTAMP(id, task) \ | 50 | #define LTIMESTAMP(id, task) \ |
47 | ft_event1(id, save_task_latency, (unsigned long) task) | 51 | ft_event1(id, save_task_latency, (unsigned long) task) |
48 | 52 | ||
53 | #define TIMESTAMP_TIME(id, time_ptr) \ | ||
54 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) | ||
55 | |||
49 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ | 56 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ |
50 | 57 | ||
51 | #define TIMESTAMP(id) /* no tracing */ | 58 | #define TIMESTAMP(id) /* no tracing */ |
52 | 59 | ||
53 | #define DTIMESTAMP(id, def) /* no tracing */ | 60 | #define DTIMESTAMP(id, def) /* no tracing */ |
54 | 61 | ||
62 | #define TIMESTAMP_CUR(id) /* no tracing */ | ||
63 | |||
55 | #define TTIMESTAMP(id, task) /* no tracing */ | 64 | #define TTIMESTAMP(id, task) /* no tracing */ |
56 | 65 | ||
57 | #define CTIMESTAMP(id, cpu) /* no tracing */ | 66 | #define CTIMESTAMP(id, cpu) /* no tracing */ |
58 | 67 | ||
59 | #define LTIMESTAMP(id, when_ptr) /* no tracing */ | 68 | #define LTIMESTAMP(id, when_ptr) /* no tracing */ |
60 | 69 | ||
70 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ | ||
71 | |||
61 | #endif | 72 | #endif |
62 | 73 | ||
63 | 74 | ||
@@ -69,7 +80,20 @@ feather_callback void save_task_latency(unsigned long event, unsigned long when_ | |||
69 | * always the next number after the start time event id. | 80 | * always the next number after the start time event id. |
70 | */ | 81 | */ |
71 | 82 | ||
83 | #define __TS_SYSCALL_IN_START(p) TIMESTAMP_TIME(10, p) | ||
84 | #define TS_SYSCALL_IN_END TIMESTAMP_CUR(11) | ||
72 | 85 | ||
86 | #define TS_SYSCALL_OUT_START TIMESTAMP_CUR(20) | ||
87 | #define TS_SYSCALL_OUT_END TIMESTAMP_CUR(21) | ||
88 | |||
89 | #define TS_LOCK_START TIMESTAMP_CUR(30) | ||
90 | #define TS_LOCK_END TIMESTAMP_CUR(31) | ||
91 | |||
92 | #define TS_LOCK_SUSPEND TIMESTAMP_CUR(38) | ||
93 | #define TS_LOCK_RESUME TIMESTAMP_CUR(39) | ||
94 | |||
95 | #define TS_UNLOCK_START TIMESTAMP_CUR(40) | ||
96 | #define TS_UNLOCK_END TIMESTAMP_CUR(41) | ||
73 | 97 | ||
74 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only | 98 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only |
75 | * care | 99 | * care |
@@ -101,14 +125,6 @@ feather_callback void save_task_latency(unsigned long event, unsigned long when_ | |||
101 | #define TS_EXIT_NP_START TIMESTAMP(150) | 125 | #define TS_EXIT_NP_START TIMESTAMP(150) |
102 | #define TS_EXIT_NP_END TIMESTAMP(151) | 126 | #define TS_EXIT_NP_END TIMESTAMP(151) |
103 | 127 | ||
104 | #define TS_LOCK_START TIMESTAMP(170) | ||
105 | #define TS_LOCK_SUSPEND TIMESTAMP(171) | ||
106 | #define TS_LOCK_RESUME TIMESTAMP(172) | ||
107 | #define TS_LOCK_END TIMESTAMP(173) | ||
108 | |||
109 | #define TS_UNLOCK_START TIMESTAMP(180) | ||
110 | #define TS_UNLOCK_END TIMESTAMP(181) | ||
111 | |||
112 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 128 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
113 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) | 129 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) |
114 | 130 | ||
diff --git a/litmus/locking.c b/litmus/locking.c index ca5a073a989e..df7d0a939c08 100644 --- a/litmus/locking.c +++ b/litmus/locking.c | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | #ifdef CONFIG_LITMUS_LOCKING | 3 | #ifdef CONFIG_LITMUS_LOCKING |
4 | 4 | ||
5 | #include <linux/sched.h> | ||
6 | #include <litmus/litmus.h> | ||
5 | #include <litmus/sched_plugin.h> | 7 | #include <litmus/sched_plugin.h> |
6 | #include <litmus/trace.h> | 8 | #include <litmus/trace.h> |
7 | #include <litmus/wait.h> | 9 | #include <litmus/wait.h> |
diff --git a/litmus/trace.c b/litmus/trace.c index 7d726a8e8e02..fc1d03f35d39 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -74,6 +74,7 @@ static void __add_timestamp_user(struct timestamp *pre_recorded) | |||
74 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | 74 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { |
75 | *ts = *pre_recorded; | 75 | *ts = *pre_recorded; |
76 | ts->seq_no = seq_no; | 76 | ts->seq_no = seq_no; |
77 | ts->cpu = raw_smp_processor_id(); | ||
77 | __save_irq_flags(ts); | 78 | __save_irq_flags(ts); |
78 | ft_buffer_finish_write(trace_ts_buf, ts); | 79 | ft_buffer_finish_write(trace_ts_buf, ts); |
79 | } | 80 | } |
@@ -136,6 +137,26 @@ feather_callback void save_task_latency(unsigned long event, | |||
136 | } | 137 | } |
137 | } | 138 | } |
138 | 139 | ||
140 | /* fake timestamp to user-reported time */ | ||
141 | void save_timestamp_time(unsigned long event, | ||
142 | unsigned long ptr) | ||
143 | { | ||
144 | uint64_t* time = (uint64_t*) ptr; | ||
145 | unsigned int seq_no; | ||
146 | struct timestamp *ts; | ||
147 | seq_no = fetch_and_inc((int *) &ts_seq_no); | ||
148 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | ||
149 | ts->event = event; | ||
150 | ts->seq_no = seq_no; | ||
151 | ts->pid = current->pid; | ||
152 | ts->cpu = raw_smp_processor_id(); | ||
153 | ts->task_type = is_realtime(current) ? TSK_RT : TSK_BE; | ||
154 | __save_irq_flags(ts); | ||
155 | ts->timestamp = *time; | ||
156 | ft_buffer_finish_write(trace_ts_buf, ts); | ||
157 | } | ||
158 | } | ||
159 | |||
139 | /******************************************************************************/ | 160 | /******************************************************************************/ |
140 | /* DEVICE FILE DRIVER */ | 161 | /* DEVICE FILE DRIVER */ |
141 | /******************************************************************************/ | 162 | /******************************************************************************/ |