diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-25 12:42:27 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-10-10 17:14:34 -0400 |
commit | 88f2d7fbab4ceba14946cb86c018bc8a2025e876 (patch) | |
tree | c5bdd383f1f3c1b52804324b1f4af7b4e09a38e8 /litmus | |
parent | 81d6f2711010d4073e29ea38bc717ee6f4ed3a53 (diff) |
locking: trace system call entry/exit cost
Diffstat (limited to 'litmus')
-rw-r--r-- | litmus/locking.c | 16 | ||||
-rw-r--r-- | litmus/trace.c | 24 |
2 files changed, 40 insertions, 0 deletions
diff --git a/litmus/locking.c b/litmus/locking.c index 728b56835cf7..cfbc1ba59217 100644 --- a/litmus/locking.c +++ b/litmus/locking.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #include <linux/sched.h> | ||
2 | #include <litmus/litmus.h> | ||
1 | #include <litmus/fdso.h> | 3 | #include <litmus/fdso.h> |
2 | 4 | ||
3 | #ifdef CONFIG_LITMUS_LOCKING | 5 | #ifdef CONFIG_LITMUS_LOCKING |
@@ -69,6 +71,11 @@ asmlinkage long sys_litmus_lock(int lock_od) | |||
69 | struct od_table_entry* entry; | 71 | struct od_table_entry* entry; |
70 | struct litmus_lock* l; | 72 | struct litmus_lock* l; |
71 | 73 | ||
74 | if (has_control_page(current)) | ||
75 | TS_SYSCALL_IN_START(&get_control_page(current)->ts_syscall_start); | ||
76 | |||
77 | TS_SYSCALL_IN_END; | ||
78 | |||
72 | TS_LOCK_START; | 79 | TS_LOCK_START; |
73 | 80 | ||
74 | entry = get_entry_for_od(lock_od); | 81 | entry = get_entry_for_od(lock_od); |
@@ -82,6 +89,8 @@ asmlinkage long sys_litmus_lock(int lock_od) | |||
82 | * this into account when computing overheads. */ | 89 | * this into account when computing overheads. */ |
83 | TS_UNLOCK_END; | 90 | TS_UNLOCK_END; |
84 | 91 | ||
92 | TS_SYSCALL_OUT_START; | ||
93 | |||
85 | return err; | 94 | return err; |
86 | } | 95 | } |
87 | 96 | ||
@@ -91,6 +100,11 @@ asmlinkage long sys_litmus_unlock(int lock_od) | |||
91 | struct od_table_entry* entry; | 100 | struct od_table_entry* entry; |
92 | struct litmus_lock* l; | 101 | struct litmus_lock* l; |
93 | 102 | ||
103 | if (has_control_page(current)) | ||
104 | TS_SYSCALL_IN_START(&get_control_page(current)->ts_syscall_start); | ||
105 | |||
106 | TS_SYSCALL_IN_END; | ||
107 | |||
94 | TS_UNLOCK_START; | 108 | TS_UNLOCK_START; |
95 | 109 | ||
96 | entry = get_entry_for_od(lock_od); | 110 | entry = get_entry_for_od(lock_od); |
@@ -104,6 +118,8 @@ asmlinkage long sys_litmus_unlock(int lock_od) | |||
104 | * account when computing overheads. */ | 118 | * account when computing overheads. */ |
105 | TS_UNLOCK_END; | 119 | TS_UNLOCK_END; |
106 | 120 | ||
121 | TS_SYSCALL_OUT_START; | ||
122 | |||
107 | return err; | 123 | return err; |
108 | } | 124 | } |
109 | 125 | ||
diff --git a/litmus/trace.c b/litmus/trace.c index e7ea1c2ab3e4..23763c19fa6b 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -37,6 +37,30 @@ 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) | ||
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) | ||
49 | { | ||
50 | uint64_t* time = (uint64_t*) ptr; | ||
51 | unsigned int seq_no; | ||
52 | struct timestamp *ts; | ||
53 | seq_no = fetch_and_inc((int *) &ts_seq_no); | ||
54 | if (ft_buffer_start_write(trace_ts_buf, (void**) &ts)) { | ||
55 | ts->event = event; | ||
56 | ts->timestamp = *time; | ||
57 | ts->seq_no = seq_no; | ||
58 | ts->cpu = raw_smp_processor_id(); | ||
59 | ts->task_type = task_type(current); | ||
60 | ft_buffer_finish_write(trace_ts_buf, ts); | ||
61 | } | ||
62 | } | ||
63 | |||
40 | feather_callback void save_timestamp(unsigned long event) | 64 | feather_callback void save_timestamp(unsigned long event) |
41 | { | 65 | { |
42 | __save_timestamp(event, TSK_UNKNOWN); | 66 | __save_timestamp(event, TSK_UNKNOWN); |