[Crash-utility] [PATCH v2 14/25] modify timer -r to hide offline cpus' data

Qiao Nuohan qiaonuohan at cn.fujitsu.com
Mon Sep 29 02:09:12 UTC 2014


timer -r will display hrtimer. This patch will hide offline cpus.

The original output is like below:
<cut>
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
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> timer -r
...
  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff88003fc8e800  [ktime_get_boottime]
  (empty)

CPU: 2  <OFFLINE>

CPU: 3  HRTIMER_CPU_BASE: ffff88003fd8e740
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
---
 kernel.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel.c b/kernel.c
index 8063d61..0665ada 100755
--- a/kernel.c
+++ b/kernel.c
@@ -6765,9 +6765,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




More information about the Crash-utility mailing list