From a74f889d9ada5ebe7c86b48f3aa0e3ceb5b9991d Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Thu, 25 Sep 2014 10:27:30 +0800 Subject: [PATCH v3 11/21] modify timer -r to hide offline cpus' data timer -r will display hrtimer. This patch will hide offline cpus. The original output is like below: crash> timer -r ... CLOCK: 2 HRTIMER_CLOCK_BASE: ffff88003fc8e800 [ktime_get_boottime] (empty) CPU: 2 HRTIMER_CPU_BASE: ffff88003fd0e740 CLOCK: 0 HRTIMER_CLOCK_BASE: ffff88003fd0e780 [ktime_get] (empty) CLOCK: 1 HRTIMER_CLOCK_BASE: ffff88003fd0e7c0 [ktime_get_real] (empty) CLOCK: 2 HRTIMER_CLOCK_BASE: ffff88003fd0e800 [ktime_get_boottime] (empty) CPU: 3 HRTIMER_CPU_BASE: ffff88003fd8e740 ... With data of offline cpu(cpu #2) hiden, the output is like below: crash> timer -r ... CLOCK: 2 HRTIMER_CLOCK_BASE: ffff88003fc8e800 [ktime_get_boottime] (empty) CPU: 2 [OFFLINE] CPU: 3 HRTIMER_CPU_BASE: ffff88003fd8e740 ... Signed-off-by: Qiao Nuohan --- kernel.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel.c b/kernel.c index ddf55aa..377e03c 100755 --- a/kernel.c +++ b/kernel.c @@ -6761,9 +6761,16 @@ dump_hrtimer_data(void) option_not_supported('r'); hrtimer_bases = per_cpu_symbol_search("hrtimer_bases"); + for (i = 0; i < kt->cpus; i++) { if (i) fprintf(fp, "\n"); + + if (hide_offline_cpu(i)) { + fprintf(fp, "CPU: %d [OFFLINE]\n", i); + continue; + } + fprintf(fp, "CPU: %d ", i); if (VALID_STRUCT(hrtimer_clock_base)) { fprintf(fp, "HRTIMER_CPU_BASE: %lx\n", -- 1.8.5.3