aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/trace.c
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-25 17:22:29 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-25 17:22:29 -0400
commitb5d621c9e223365e149b7ebfdf6a5889c843b5be (patch)
tree399acbcdb10e3e4133173d99f5512933eef72fcf /litmus/trace.c
parent5b1c2dd0500195cdd0f0db550547ebdf4c4a8e75 (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).
Diffstat (limited to 'litmus/trace.c')
-rw-r--r--litmus/trace.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/litmus/trace.c b/litmus/trace.c
index 6e123e6e0170..39200c8ff74e 100644
--- a/litmus/trace.c
+++ b/litmus/trace.c
@@ -41,7 +41,6 @@ static void __add_timestamp_user(struct timestamp *pre_recorded)
41 if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { 41 if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) {
42 *ts = *pre_recorded; 42 *ts = *pre_recorded;
43 ts->seq_no = seq_no; 43 ts->seq_no = seq_no;
44 ts->cpu = raw_smp_processor_id();
45 ft_buffer_finish_write(trace_ts_buf, ts); 44 ft_buffer_finish_write(trace_ts_buf, ts);
46 } 45 }
47} 46}
@@ -52,14 +51,7 @@ static inline void __save_timestamp(unsigned long event,
52 __save_timestamp_cpu(event, type, raw_smp_processor_id()); 51 __save_timestamp_cpu(event, type, raw_smp_processor_id());
53} 52}
54 53
55static inline uint8_t task_type(struct task_struct* t) 54/* hack: fake timestamp to user-reported time, and record parts of the PID */
56{
57 if (!t)
58 return TSK_UNKNOWN;
59 else
60 return is_realtime(t) ? TSK_RT : TSK_BE;
61}
62
63feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr) 55feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr)
64{ 56{
65 uint64_t* time = (uint64_t*) ptr; 57 uint64_t* time = (uint64_t*) ptr;
@@ -70,12 +62,25 @@ feather_callback void save_timestamp_time(unsigned long event, unsigned long ptr
70 ts->event = event; 62 ts->event = event;
71 ts->timestamp = *time; 63 ts->timestamp = *time;
72 ts->seq_no = seq_no; 64 ts->seq_no = seq_no;
73 ts->cpu = raw_smp_processor_id(); 65 /* type takes lowest byte of PID */
74 ts->task_type = task_type(current); 66 ts->task_type = (uint8_t) current->pid;
67 /* cpu takes second-lowest byte of PID*/
68 ts->cpu = (uint8_t) (current->pid >> 8);
69
75 ft_buffer_finish_write(trace_ts_buf, ts); 70 ft_buffer_finish_write(trace_ts_buf, ts);
76 } 71 }
77} 72}
78 73
74feather_callback void save_timestamp_pid(unsigned long event)
75{
76 /* Abuse existing fields to partially export PID. */
77 __save_timestamp_cpu(event,
78 /* type takes lowest byte of PID */
79 (uint8_t) current->pid,
80 /* cpu takes second-lowest byte of PID*/
81 (uint8_t) (current->pid >> 8));
82}
83
79feather_callback void save_timestamp(unsigned long event) 84feather_callback void save_timestamp(unsigned long event)
80{ 85{
81 __save_timestamp(event, TSK_UNKNOWN); 86 __save_timestamp(event, TSK_UNKNOWN);