From adf9aa9c985dfd72ecf04e17d785689d60ac66e7 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" <bbb@cs.unc.edu> Date: Tue, 28 Apr 2009 14:54:39 -0400 Subject: add support for tracing IPI latency --- include/litmus/trace.h | 12 +++++++++++- litmus/trace.c | 23 +++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/include/litmus/trace.h b/include/litmus/trace.h index 620d1ac303..e8e0c7b6cc 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h @@ -27,12 +27,18 @@ struct timestamp { 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); + #define TIMESTAMP(id) ft_event0(id, save_timestamp) #define DTIMESTAMP(id, def) ft_event1(id, save_timestamp_def, def) -#define TTIMESTAMP(id, task) ft_event1(id, save_timestamp_task, (unsigned long) task) +#define TTIMESTAMP(id, task) \ + ft_event1(id, save_timestamp_task, (unsigned long) task) + +#define CTIMESTAMP(id, cpu) \ + ft_event1(id, save_timestamp_cpu, cpu) #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ @@ -42,6 +48,8 @@ feather_callback void save_timestamp_task(unsigned long event, unsigned long t_p #define TTIMESTAMP(id, task) /* no tracing */ +#define CTIMESTAMP(id, cpu) /* no tracing */ + #endif @@ -98,6 +106,8 @@ feather_callback void save_timestamp_task(unsigned long event, unsigned long t_p #define TS_FIFO_DOWN_START TIMESTAMP(182) #define TS_FIFO_DOWN_END TIMESTAMP(183) +#define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) +#define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) #endif /* !_SYS_TRACE_H_ */ diff --git a/litmus/trace.c b/litmus/trace.c index 8851198330..6a134121e1 100644 --- a/litmus/trace.c +++ b/litmus/trace.c @@ -14,7 +14,8 @@ static struct ftdev overhead_dev; static unsigned int ts_seq_no = 0; -static inline void __save_timestamp(unsigned long event, uint8_t type) +static inline void __save_timestamp_cpu(unsigned long event, + uint8_t type, uint8_t cpu) { unsigned int seq_no; struct timestamp *ts; @@ -23,28 +24,42 @@ static inline void __save_timestamp(unsigned long event, uint8_t type) ts->event = event; ts->timestamp = ft_timestamp(); ts->seq_no = seq_no; - ts->cpu = raw_smp_processor_id(); + ts->cpu = cpu; ts->task_type = type; ft_buffer_finish_write(trace_ts_buf, ts); } } +static inline void __save_timestamp(unsigned long event, + uint8_t type) +{ + __save_timestamp_cpu(event, type, raw_smp_processor_id()); +} + feather_callback void save_timestamp(unsigned long event) { __save_timestamp(event, TSK_UNKNOWN); } -feather_callback void save_timestamp_def(unsigned long event, unsigned long type) +feather_callback void save_timestamp_def(unsigned long event, + unsigned long type) { __save_timestamp(event, (uint8_t) type); } -feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr) +feather_callback void save_timestamp_task(unsigned long event, + unsigned long t_ptr) { int rt = is_realtime((struct task_struct *) t_ptr); __save_timestamp(event, rt ? TSK_RT : TSK_BE); } +feather_callback void save_timestamp_cpu(unsigned long event, + unsigned long cpu) +{ + __save_timestamp_cpu(event, TSK_UNKNOWN, cpu); +} + /******************************************************************************/ /* DEVICE FILE DRIVER */ /******************************************************************************/ -- cgit v1.2.2