diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-25 17:22:29 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-10-10 17:28:36 -0400 |
commit | c83d480d352ca8b2eae419966d6feae02d16aeff (patch) | |
tree | a78ed74e9bd25685780b12542368be11fcdf70c9 | |
parent | b1a51931633520901fa771dcf0b7c7d78fe4a304 (diff) |
Feather-Trace: record PID fragments for locking overheads
We need to be able to figure out overlapping suspensions, etc.
So to reuse the existing format, just encode the lower 16bits of
the PID in the cpu and task-type fields (which we don't care about
when collecting locking overheads).
-rw-r--r-- | include/litmus/trace.h | 23 | ||||
-rw-r--r-- | litmus/trace.c | 26 |
2 files changed, 31 insertions, 18 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index b7f705dca20b..059cee4c7ffd 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -47,6 +47,8 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
47 | #define TIMESTAMP_TIME(id, time_ptr) \ | 47 | #define TIMESTAMP_TIME(id, time_ptr) \ |
48 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) | 48 | ft_event1(id, save_timestamp_time, (unsigned long) time_ptr) |
49 | 49 | ||
50 | #define TIMESTAMP_PID(id) ft_event0(id, save_timestamp_pid) | ||
51 | |||
50 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ | 52 | #else /* !CONFIG_SCHED_OVERHEAD_TRACE */ |
51 | 53 | ||
52 | #define TIMESTAMP(id) /* no tracing */ | 54 | #define TIMESTAMP(id) /* no tracing */ |
@@ -61,6 +63,8 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
61 | 63 | ||
62 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ | 64 | #define TIMESTAMP_TIME(id, time_ptr) /* no tracing */ |
63 | 65 | ||
66 | #define TIMESTAMP_PID(id) /* no tracing */ | ||
67 | |||
64 | #endif | 68 | #endif |
65 | 69 | ||
66 | 70 | ||
@@ -73,10 +77,18 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
73 | */ | 77 | */ |
74 | 78 | ||
75 | #define TS_SYSCALL_IN_START(p) TIMESTAMP_TIME(10, p) | 79 | #define TS_SYSCALL_IN_START(p) TIMESTAMP_TIME(10, p) |
76 | #define TS_SYSCALL_IN_END TIMESTAMP(11) | 80 | #define TS_SYSCALL_IN_END TIMESTAMP_PID(11) |
81 | |||
82 | #define TS_SYSCALL_OUT_START TIMESTAMP_PID(20) | ||
83 | #define TS_SYSCALL_OUT_END TIMESTAMP_PID(21) | ||
77 | 84 | ||
78 | #define TS_SYSCALL_OUT_START TIMESTAMP(20) | 85 | #define TS_LOCK_START TIMESTAMP_PID(30) |
79 | #define TS_SYSCALL_OUT_END TIMESTAMP(21) | 86 | #define TS_LOCK_SUSPEND TIMESTAMP_PID(31) |
87 | #define TS_LOCK_RESUME TIMESTAMP_PID(32) | ||
88 | #define TS_LOCK_END TIMESTAMP_PID(33) | ||
89 | |||
90 | #define TS_UNLOCK_START TIMESTAMP_PID(40) | ||
91 | #define TS_UNLOCK_END TIMESTAMP_PID(41) | ||
80 | 92 | ||
81 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only | 93 | #define TS_SCHED_START DTIMESTAMP(100, TSK_UNKNOWN) /* we only |
82 | * care | 94 | * care |
@@ -108,11 +120,6 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long tim | |||
108 | #define TS_EXIT_NP_START TIMESTAMP(150) | 120 | #define TS_EXIT_NP_START TIMESTAMP(150) |
109 | #define TS_EXIT_NP_END TIMESTAMP(151) | 121 | #define TS_EXIT_NP_END TIMESTAMP(151) |
110 | 122 | ||
111 | #define TS_LOCK_START TIMESTAMP(170) | ||
112 | #define TS_LOCK_END TIMESTAMP(171) | ||
113 | #define TS_UNLOCK_START TIMESTAMP(172) | ||
114 | #define TS_UNLOCK_END TIMESTAMP(173) | ||
115 | |||
116 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) | 123 | #define TS_SEND_RESCHED_START(c) CTIMESTAMP(190, c) |
117 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) | 124 | #define TS_SEND_RESCHED_END DTIMESTAMP(191, TSK_UNKNOWN) |
118 | 125 | ||
diff --git a/litmus/trace.c b/litmus/trace.c index 23763c19fa6b..49f8246cda50 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -37,14 +37,7 @@ static inline void __save_timestamp(unsigned long event, | |||
37 | __save_timestamp_cpu(event, type, raw_smp_processor_id()); | 37 | __save_timestamp_cpu(event, type, raw_smp_processor_id()); |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline uint8_t task_type(struct task_struct* t) | 40 | /* hack: fake timestamp to user-reported time, and record parts of the PID */ |
41 | { | ||
42 | if (!t) | ||
43 | return TSK_UNKNOWN; | ||
44 | else | ||
45 | return is_realtime(t) ? TSK_RT : TSK_BE; | ||
46 | } | ||
47 | |||
48 | feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr) | 41 | feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr) |
49 | { | 42 | { |
50 | uint64_t* time = (uint64_t*) ptr; | 43 | uint64_t* time = (uint64_t*) ptr; |
@@ -55,12 +48,25 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr | |||
55 | ts->event = event; | 48 | ts->event = event; |
56 | ts->timestamp = *time; | 49 | ts->timestamp = *time; |
57 | ts->seq_no = seq_no; | 50 | ts->seq_no = seq_no; |
58 | ts->cpu = raw_smp_processor_id(); | 51 | /* type takes lowest byte of PID */ |
59 | ts->task_type = task_type(current); | 52 | ts->task_type = (uint8_t) current->pid; |
53 | /* cpu takes second-lowest byte of PID*/ | ||
54 | ts->cpu = (uint8_t) (current->pid >> 8); | ||
55 | |||
60 | ft_buffer_finish_write(trace_ts_buf, ts); | 56 | ft_buffer_finish_write(trace_ts_buf, ts); |
61 | } | 57 | } |
62 | } | 58 | } |
63 | 59 | ||
60 | feather_callback void save_timestamp_pid(unsigned long event) | ||
61 | { | ||
62 | /* Abuse existing fields to partially export PID. */ | ||
63 | __save_timestamp_cpu(event, | ||
64 | /* type takes lowest byte of PID */ | ||
65 | (uint8_t) current->pid, | ||
66 | /* cpu takes second-lowest byte of PID*/ | ||
67 | (uint8_t) (current->pid >> 8)); | ||
68 | } | ||
69 | |||
64 | feather_callback void save_timestamp(unsigned long event) | 70 | feather_callback void save_timestamp(unsigned long event) |
65 | { | 71 | { |
66 | __save_timestamp(event, TSK_UNKNOWN); | 72 | __save_timestamp(event, TSK_UNKNOWN); |