diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-05 23:15:09 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-11-24 15:21:04 -0500 |
commit | 1dead199b4ae68ab98eacec4a661fd5ecb5a2704 (patch) | |
tree | f15c9a70f79bab4e7c6ca8937710b9f02ee76f0b | |
parent | 4490f9ecf94e28458069a02e8cfcf4f385390499 (diff) |
Feather-Trace: keep track of release latency
-rw-r--r-- | include/litmus/trace.h | 10 | ||||
-rw-r--r-- | litmus/rt_domain.c | 4 | ||||
-rw-r--r-- | litmus/trace.c | 20 |
3 files changed, 32 insertions, 2 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index a725e8b583ba..e2926a08c2f4 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -28,7 +28,7 @@ feather_callback void save_timestamp(unsigned long event); | |||
28 | feather_callback void save_timestamp_def(unsigned long event, unsigned long type); | 28 | feather_callback void save_timestamp_def(unsigned long event, unsigned long type); |
29 | feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr); | 29 | feather_callback void save_timestamp_task(unsigned long event, unsigned long t_ptr); |
30 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); | 30 | feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu); |
31 | 31 | feather_callback void save_task_latency(unsigned long event, unsigned long when_ptr); | |
32 | 32 | ||
33 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) | 33 | #define TIMESTAMP(id) ft_event0(id, save_timestamp) |
34 | 34 | ||
@@ -40,6 +40,9 @@ feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu) | |||
40 | #define CTIMESTAMP(id, cpu) \ | 40 | #define CTIMESTAMP(id, cpu) \ |
41 | ft_event1(id, save_timestamp_cpu, (unsigned long) cpu) | 41 | ft_event1(id, save_timestamp_cpu, (unsigned long) cpu) |
42 | 42 | ||
43 | #define LTIMESTAMP(id, task) \ | ||
44 | ft_event1(id, save_task_latency, (unsigned long) task) | ||
45 | |||
43 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ | 46 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ |
44 | 47 | ||
45 | #define TIMESTAMP(id) /* no tracing */ | 48 | #define TIMESTAMP(id) /* no tracing */ |
@@ -50,6 +53,8 @@ feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu) | |||
50 | 53 | ||
51 | #define CTIMESTAMP(id, cpu) /* no tracing */ | 54 | #define CTIMESTAMP(id, cpu) /* no tracing */ |
52 | 55 | ||
56 | #define LTIMESTAMP(id, when_ptr) /* no tracing */ | ||
57 | |||
53 | #endif | 58 | #endif |
54 | 59 | ||
55 | 60 | ||
@@ -61,6 +66,8 @@ feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu) | |||
61 | * always the next number after the start time event id. | 66 | * always the next number after the start time event id. |
62 | */ | 67 | */ |
63 | 68 | ||
69 | |||
70 | |||
64 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only | 71 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only |
65 | * care | 72 | * care |
66 | * about | 73 | * about |
@@ -102,5 +109,6 @@ feather_callback void save_timestamp_cpu(unsigned long event, unsigned long cpu) | |||
102 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 109 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
103 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) | 110 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) |
104 | 111 | ||
112 | #define TS_RELEASE_LATENCY(when) LTIMESTAMP(208, &(when)) | ||
105 | 113 | ||
106 | #endif /* !_SYS_TRACE_H_ */ | 114 | #endif /* !_SYS_TRACE_H_ */ |
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c index 81a5ac16f164..d405854cd39c 100644 --- a/litmus/rt_domain.c +++ b/litmus/rt_domain.c | |||
@@ -55,12 +55,14 @@ static enum hrtimer_restart on_release_timer(struct hrtimer *timer) | |||
55 | { | 55 | { |
56 | unsigned long flags; | 56 | unsigned long flags; |
57 | struct release_heap* rh; | 57 | struct release_heap* rh; |
58 | rh = container_of(timer, struct release_heap, timer); | ||
59 | |||
60 | TS_RELEASE_LATENCY(rh->release_time); | ||
58 | 61 | ||
59 | VTRACE("on_release_timer(0x%p) starts.\n", timer); | 62 | VTRACE("on_release_timer(0x%p) starts.\n", timer); |
60 | 63 | ||
61 | TS_RELEASE_START; | 64 | TS_RELEASE_START; |
62 | 65 | ||
63 | rh = container_of(timer, struct release_heap, timer); | ||
64 | 66 | ||
65 | raw_spin_lock_irqsave(&rh->dom->release_lock, flags); | 67 | raw_spin_lock_irqsave(&rh->dom->release_lock, flags); |
66 | VTRACE("CB has the release_lock 0x%p\n", &rh->dom->release_lock); | 68 | VTRACE("CB has the release_lock 0x%p\n", &rh->dom->release_lock); |
diff --git a/litmus/trace.c b/litmus/trace.c index 1e916aa406b9..f0eb2c706488 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -61,6 +61,26 @@ feather_callback void save_timestamp_cpu(unsigned long event, | |||
61 | __save_timestamp_cpu(event, TSK_UNKNOWN, cpu); | 61 | __save_timestamp_cpu(event, TSK_UNKNOWN, cpu); |
62 | } | 62 | } |
63 | 63 | ||
64 | feather_callback void save_task_latency(unsigned long event, | ||
65 | unsigned long when_ptr) | ||
66 | { | ||
67 | lt_t now = litmus_clock(); | ||
68 | lt_t *when = (lt_t*) when_ptr; | ||
69 | unsigned int seq_no; | ||
70 | int cpu = raw_smp_processor_id(); | ||
71 | struct timestamp *ts; | ||
72 | |||
73 | seq_no = fetch_and_inc((int *) &ts_seq_no); | ||
74 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | ||
75 | ts->event = event; | ||
76 | ts->timestamp = now - *when; | ||
77 | ts->seq_no = seq_no; | ||
78 | ts->cpu = cpu; | ||
79 | ts->task_type = TSK_RT; | ||
80 | ft_buffer_finish_write(trace_ts_buf, ts); | ||
81 | } | ||
82 | } | ||
83 | |||
64 | /******************************************************************************/ | 84 | /******************************************************************************/ |
65 | /* DEVICE FILE DRIVER */ | 85 | /* DEVICE FILE DRIVER */ |
66 | /******************************************************************************/ | 86 | /******************************************************************************/ |