diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-15 07:04:40 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-10-18 14:49:01 -0400 |
commit | 7b84800f5ee2e35671ac08a7d281ac7f0069ce8f (patch) | |
tree | c637ecaa4294e7ef092838d2ede0e0953404fd9a /litmus | |
parent | 676bcd5d0245afba6b723e4d1bf4a65692fa986d (diff) |
Feather-Trace: keep track of PID in trace record
To properly trace locking overheads, it is required to tell apart
samples from different tasks, which requires keeping track of their
PIDs.
The timestamp is shortened to 48 bits to make room for the PID.
Diffstat (limited to 'litmus')
-rw-r--r-- | litmus/trace.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/litmus/trace.c b/litmus/trace.c index 3c35c527e805..7d726a8e8e02 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -46,7 +46,8 @@ static inline void __save_irq_flags(struct timestamp *ts) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void __save_timestamp_cpu(unsigned long event, | 48 | static inline void __save_timestamp_cpu(unsigned long event, |
49 | uint8_t type, uint8_t cpu) | 49 | uint8_t type, uint8_t cpu, |
50 | uint16_t pid_fragment) | ||
50 | { | 51 | { |
51 | unsigned int seq_no; | 52 | unsigned int seq_no; |
52 | struct timestamp *ts; | 53 | struct timestamp *ts; |
@@ -54,6 +55,7 @@ static inline void __save_timestamp_cpu(unsigned long event, | |||
54 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | 55 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { |
55 | ts->event = event; | 56 | ts->event = event; |
56 | ts->seq_no = seq_no; | 57 | ts->seq_no = seq_no; |
58 | ts->pid = pid_fragment; | ||
57 | ts->cpu = cpu; | 59 | ts->cpu = cpu; |
58 | ts->task_type = type; | 60 | ts->task_type = type; |
59 | __save_irq_flags(ts); | 61 | __save_irq_flags(ts); |
@@ -78,9 +80,10 @@ static void __add_timestamp_user(struct timestamp *pre_recorded) | |||
78 | } | 80 | } |
79 | 81 | ||
80 | static inline void __save_timestamp(unsigned long event, | 82 | static inline void __save_timestamp(unsigned long event, |
81 | uint8_t type) | 83 | uint8_t type) |
82 | { | 84 | { |
83 | __save_timestamp_cpu(event, type, raw_smp_processor_id()); | 85 | __save_timestamp_cpu(event, type, raw_smp_processor_id(), |
86 | current->pid); | ||
84 | } | 87 | } |
85 | 88 | ||
86 | feather_callback void save_timestamp(unsigned long event) | 89 | feather_callback void save_timestamp(unsigned long event) |
@@ -97,14 +100,18 @@ feather_callback void save_timestamp_def(unsigned long event, | |||
97 | feather_callback void save_timestamp_task(unsigned long event, | 100 | feather_callback void save_timestamp_task(unsigned long event, |
98 | unsigned long t_ptr) | 101 | unsigned long t_ptr) |
99 | { | 102 | { |
100 | int rt = is_realtime((struct task_struct *) t_ptr); | 103 | struct task_struct *t = (struct task_struct *) t_ptr; |
101 | __save_timestamp(event, rt ? TSK_RT : TSK_BE); | 104 | int rt = is_realtime(t); |
105 | __save_timestamp_cpu(event, rt ? TSK_RT : TSK_BE, | ||
106 | raw_smp_processor_id(), | ||
107 | t->pid); | ||
102 | } | 108 | } |
103 | 109 | ||
104 | feather_callback void save_timestamp_cpu(unsigned long event, | 110 | feather_callback void save_timestamp_cpu(unsigned long event, |
105 | unsigned long cpu) | 111 | unsigned long cpu) |
106 | { | 112 | { |
107 | __save_timestamp_cpu(event, TSK_UNKNOWN, cpu); | 113 | __save_timestamp_cpu(event, TSK_UNKNOWN, cpu, |
114 | current->pid); | ||
108 | } | 115 | } |
109 | 116 | ||
110 | feather_callback void save_task_latency(unsigned long event, | 117 | feather_callback void save_task_latency(unsigned long event, |
@@ -122,6 +129,7 @@ feather_callback void save_task_latency(unsigned long event, | |||
122 | ts->timestamp = now - *when; | 129 | ts->timestamp = now - *when; |
123 | ts->seq_no = seq_no; | 130 | ts->seq_no = seq_no; |
124 | ts->cpu = cpu; | 131 | ts->cpu = cpu; |
132 | ts->pid = 0; | ||
125 | ts->task_type = TSK_RT; | 133 | ts->task_type = TSK_RT; |
126 | __save_irq_flags(ts); | 134 | __save_irq_flags(ts); |
127 | ft_buffer_finish_write(trace_ts_buf, ts); | 135 | ft_buffer_finish_write(trace_ts_buf, ts); |