From 2f4f08b860047bc1df6267bdfc35e78e889ed1be Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Sat, 23 Aug 2014 16:28:33 +0800 Subject: [PATCH 13/23] x86_64: modify timer -r only to display online cpus' data timer -r will display hrtimer. This patch will skip offline cpus. Signed-off-by: Qiao Nuohan --- kernel.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel.c b/kernel.c index ea3b65c..60cbfa8 100755 --- a/kernel.c +++ b/kernel.c @@ -6724,7 +6724,7 @@ cmd_timer(void) static void dump_hrtimer_data(void) { - int i, j; + int i, j, first_cpu; int hrtimer_max_clock_bases, max_hrtimer_bases; struct syment * hrtimer_bases; @@ -6746,9 +6746,17 @@ dump_hrtimer_data(void) option_not_supported('r'); hrtimer_bases = per_cpu_symbol_search("hrtimer_bases"); + + first_cpu = 1; for (i = 0; i < kt->cpus; i++) { - if (i) + if (check_offline_cpu(i)) + continue; + + if (first_cpu) + first_cpu = 0; + else fprintf(fp, "\n"); + fprintf(fp, "CPU: %d ", i); if (VALID_STRUCT(hrtimer_clock_base)) { fprintf(fp, "HRTIMER_CPU_BASE: %lx\n", -- 1.8.5.3