diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-13 12:15:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-14 09:45:11 -0400 |
commit | ea57c4f5203d82c7844c54cdef54e972cf4e9d1f (patch) | |
tree | 13eb76a07480adbfe1bcabd25cde7cdd12907ddb /tools/perf/builtin-sched.c | |
parent | aa1ab9d26ae9fe2566a9036e3cb83e7d555b3987 (diff) |
perf tools: Implement counter output multiplexing
Finish the -M/--multiplex option implementation:
- separate it out from group_fd
- correctly set it via the ioctl and dont mmap counters that
are multiplexed
- modify the perf record event loop to deal with buffer-less
counters.
- remove the -g option from perf sched record
- account for unordered events in perf sched latency
- (add -f to perf sched record to ease measurements)
- skip idle threads (pid==0) in latency output
The result is better latency output by 'perf sched latency':
-----------------------------------------------------------------------------------
Task | Runtime ms | Switches | Average delay ms | Maximum delay ms |
-----------------------------------------------------------------------------------
ksoftirqd/8 | 0.071 ms | 2 | avg: 0.458 ms | max: 0.913 ms |
at-spi-registry | 0.609 ms | 19 | avg: 0.013 ms | max: 0.023 ms |
perf | 3.316 ms | 16 | avg: 0.013 ms | max: 0.054 ms |
Xorg | 0.392 ms | 19 | avg: 0.011 ms | max: 0.018 ms |
sleep | 0.537 ms | 2 | avg: 0.009 ms | max: 0.009 ms |
-----------------------------------------------------------------------------------
TOTAL: | 4.925 ms | 58 |
---------------------------------------------
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 3e003237c42f..2ce87ef5a3e6 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -116,6 +116,8 @@ static u64 sum_fluct; | |||
116 | static u64 run_avg; | 116 | static u64 run_avg; |
117 | 117 | ||
118 | static unsigned long replay_repeat = 10; | 118 | static unsigned long replay_repeat = 10; |
119 | static unsigned long nr_timestamps; | ||
120 | static unsigned long unordered_timestamps; | ||
119 | 121 | ||
120 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | 122 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" |
121 | 123 | ||
@@ -1109,8 +1111,11 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event, | |||
1109 | if (atom->state != THREAD_SLEEPING) | 1111 | if (atom->state != THREAD_SLEEPING) |
1110 | return; | 1112 | return; |
1111 | 1113 | ||
1112 | if (atom->sched_out_time > timestamp) | 1114 | nr_timestamps++; |
1115 | if (atom->sched_out_time > timestamp) { | ||
1116 | unordered_timestamps++; | ||
1113 | return; | 1117 | return; |
1118 | } | ||
1114 | 1119 | ||
1115 | atom->state = THREAD_WAIT_CPU; | 1120 | atom->state = THREAD_WAIT_CPU; |
1116 | atom->wake_up_time = timestamp; | 1121 | atom->wake_up_time = timestamp; |
@@ -1130,6 +1135,11 @@ static void output_lat_thread(struct task_atoms *atom_list) | |||
1130 | 1135 | ||
1131 | if (!atom_list->nb_atoms) | 1136 | if (!atom_list->nb_atoms) |
1132 | return; | 1137 | return; |
1138 | /* | ||
1139 | * Ignore idle threads: | ||
1140 | */ | ||
1141 | if (!atom_list->thread->pid) | ||
1142 | return; | ||
1133 | 1143 | ||
1134 | all_runtime += atom_list->total_runtime; | 1144 | all_runtime += atom_list->total_runtime; |
1135 | all_count += atom_list->nb_atoms; | 1145 | all_count += atom_list->nb_atoms; |
@@ -1301,8 +1311,16 @@ static void __cmd_lat(void) | |||
1301 | } | 1311 | } |
1302 | 1312 | ||
1303 | printf("-----------------------------------------------------------------------------------\n"); | 1313 | printf("-----------------------------------------------------------------------------------\n"); |
1304 | printf(" TOTAL: |%9.3f ms |%9Ld |\n", | 1314 | printf(" TOTAL: |%9.3f ms |%9Ld |", |
1305 | (double)all_runtime/1e6, all_count); | 1315 | (double)all_runtime/1e6, all_count); |
1316 | |||
1317 | if (unordered_timestamps && nr_timestamps) { | ||
1318 | printf(" INFO: %.2f%% unordered events.\n", | ||
1319 | (double)unordered_timestamps/(double)nr_timestamps*100.0); | ||
1320 | } else { | ||
1321 | printf("\n"); | ||
1322 | } | ||
1323 | |||
1306 | printf("---------------------------------------------\n"); | 1324 | printf("---------------------------------------------\n"); |
1307 | } | 1325 | } |
1308 | 1326 | ||
@@ -1667,12 +1685,13 @@ static const char *record_args[] = { | |||
1667 | "-a", | 1685 | "-a", |
1668 | "-R", | 1686 | "-R", |
1669 | "-M", | 1687 | "-M", |
1670 | "-g", | 1688 | "-f", |
1671 | "-c", "1", | 1689 | "-c", "1", |
1672 | "-e", "sched:sched_switch:r", | 1690 | "-e", "sched:sched_switch:r", |
1673 | "-e", "sched:sched_stat_wait:r", | 1691 | "-e", "sched:sched_stat_wait:r", |
1674 | "-e", "sched:sched_stat_sleep:r", | 1692 | "-e", "sched:sched_stat_sleep:r", |
1675 | "-e", "sched:sched_stat_iowait:r", | 1693 | "-e", "sched:sched_stat_iowait:r", |
1694 | "-e", "sched:sched_stat_runtime:r", | ||
1676 | "-e", "sched:sched_process_exit:r", | 1695 | "-e", "sched:sched_process_exit:r", |
1677 | "-e", "sched:sched_process_fork:r", | 1696 | "-e", "sched:sched_process_fork:r", |
1678 | "-e", "sched:sched_wakeup:r", | 1697 | "-e", "sched:sched_wakeup:r", |