diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-06-23 08:43:21 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-08-07 03:46:45 -0400 |
commit | 6f7261a9e97672bcd791cf0489281a3d20e76f4a (patch) | |
tree | 7eb79a7afae733e542506b4c18853eef83cd4968 | |
parent | fa1915603340cef8c0147919f3bc99599a152a97 (diff) |
Feather-Trace: add support for latency tracing/
This patch adds support for tracing release latency in LITMUS^RT.
-rw-r--r-- | include/litmus/trace.h | 8 | ||||
-rw-r--r-- | litmus/trace.c | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 489b3d84f880..8ad4966c602e 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -32,6 +32,7 @@ feather_callback void save_timestamp(unsigned long event); | |||
32 | feather_callback void save_timestamp_def(unsigned long event, unsigned long type); | 32 | feather_callback void save_timestamp_def(unsigned long event, unsigned long type); |
33 | 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); |
34 | 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); |
35 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); | ||
35 | feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); | 36 | feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); |
36 | feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr); | 37 | feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr); |
37 | feather_callback void save_timestamp_hide_irq(unsigned long event); | 38 | feather_callback void save_timestamp_hide_irq(unsigned long event); |
@@ -48,6 +49,9 @@ feather_callback void save_timestamp_hide_irq(unsigned long event); | |||
48 | #define CTIMESTAMP(id, cpu) \ | 49 | #define CTIMESTAMP(id, cpu) \ |
49 | ft_event1(id, save_timestamp_cpu, (unsigned long) cpu) | 50 | ft_event1(id, save_timestamp_cpu, (unsigned long) cpu) |
50 | 51 | ||
52 | #define LTIMESTAMP(id, task) \ | ||
53 | ft_event1(id, save_task_latency, (unsigned long) task) | ||
54 | |||
51 | #define TIMESTAMP_TIME(id, time_ptr) \ | 55 | #define TIMESTAMP_TIME(id, time_ptr) \ |
52 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) | 56 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) |
53 | 57 | ||
@@ -69,6 +73,8 @@ feather_callback void save_timestamp_hide_irq(unsigned long event); | |||
69 | 73 | ||
70 | #define CTIMESTAMP(id, cpu) /* no tracing */ | 74 | #define CTIMESTAMP(id, cpu) /* no tracing */ |
71 | 75 | ||
76 | #define LTIMESTAMP(id, when_ptr) /* no tracing */ | ||
77 | |||
72 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ | 78 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ |
73 | 79 | ||
74 | #define TIMESTAMP_IRQ(id, irq_count_ptr) /* no tracing */ | 80 | #define TIMESTAMP_IRQ(id, irq_count_ptr) /* no tracing */ |
@@ -134,4 +140,6 @@ feather_callback void save_timestamp_hide_irq(unsigned long event); | |||
134 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 140 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
135 | #define TS_SEND_RESCHED_END TIMESTAMP_IN_IRQ(191) | 141 | #define TS_SEND_RESCHED_END TIMESTAMP_IN_IRQ(191) |
136 | 142 | ||
143 | #define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when)) | ||
144 | |||
137 | #endif /* !_SYS_TRACE_H_ */ | 145 | #endif /* !_SYS_TRACE_H_ */ |
diff --git a/litmus/trace.c b/litmus/trace.c index 7e4df5f0e12a..790686b1322c 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -155,6 +155,17 @@ feather_callback void save_timestamp_cpu(unsigned long event, | |||
155 | 0, 1); | 155 | 0, 1); |
156 | } | 156 | } |
157 | 157 | ||
158 | feather_callback void save_task_latency(unsigned long event, | ||
159 | unsigned long when_ptr) | ||
160 | { | ||
161 | lt_t now = litmus_clock(); | ||
162 | lt_t *when = (lt_t*) when_ptr; | ||
163 | |||
164 | write_timestamp(event, TSK_RT, raw_smp_processor_id(), 0, | ||
165 | 0, 1, 0, | ||
166 | now - *when, 0); | ||
167 | } | ||
168 | |||
158 | /* fake timestamp to user-reported time */ | 169 | /* fake timestamp to user-reported time */ |
159 | feather_callback void save_timestamp_time(unsigned long event, | 170 | feather_callback void save_timestamp_time(unsigned long event, |
160 | unsigned long ptr) | 171 | unsigned long ptr) |