aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-08-15 07:04:40 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-10-18 14:49:01 -0400
commit7b84800f5ee2e35671ac08a7d281ac7f0069ce8f (patch)
treec637ecaa4294e7ef092838d2ede0e0953404fd9a
parent676bcd5d0245afba6b723e4d1bf4a65692fa986d (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.
-rw-r--r--include/litmus/trace.h3
-rw-r--r--litmus/trace.c20
2 files changed, 16 insertions, 7 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h
index e809376d6487..7efced0c3078 100644
--- a/include/litmus/trace.h
+++ b/include/litmus/trace.h
@@ -16,7 +16,8 @@ enum task_type_marker {
16}; 16};
17 17
18struct timestamp { 18struct timestamp {
19 uint64_t timestamp; 19 uint64_t timestamp:48;
20 uint64_t pid:16;
20 uint32_t seq_no; 21 uint32_t seq_no;
21 uint8_t cpu; 22 uint8_t cpu;
22 uint8_t event; 23 uint8_t event;
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
48static inline void __save_timestamp_cpu(unsigned long event, 48static 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
80static inline void __save_timestamp(unsigned long event, 82static 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
86feather_callback void save_timestamp(unsigned long event) 89feather_callback void save_timestamp(unsigned long event)
@@ -97,14 +100,18 @@ feather_callback void save_timestamp_def(unsigned long event,
97feather_callback void save_timestamp_task(unsigned long event, 100feather_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
104feather_callback void save_timestamp_cpu(unsigned long event, 110feather_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
110feather_callback void save_task_latency(unsigned long event, 117feather_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);