aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-06-23 08:43:21 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-08-07 03:46:45 -0400
commit6f7261a9e97672bcd791cf0489281a3d20e76f4a (patch)
tree7eb79a7afae733e542506b4c18853eef83cd4968
parentfa1915603340cef8c0147919f3bc99599a152a97 (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.h8
-rw-r--r--litmus/trace.c11
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);
32feather_callback void save_timestamp_def(unsigned long event, unsigned long type); 32feather_callback void save_timestamp_def(unsigned long event, unsigned long type);
33feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr); 33feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr);
34feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); 34feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu);
35feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr);
35feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr); 36feather_callback void save_timestamp_time(unsigned long event, unsigned long time_ptr);
36feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr); 37feather_callback void save_timestamp_irq(unsigned long event, unsigned long irq_count_ptr);
37feather_callback void save_timestamp_hide_irq(unsigned long event); 38feather_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
158feather_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 */
159feather_callback void save_timestamp_time(unsigned long event, 170feather_callback void save_timestamp_time(unsigned long event,
160 unsigned long ptr) 171 unsigned long ptr)