Skip to contentSkip to conversation

Timertop - some improvements (3)

PATCH New Daniel Petrini 1 participant 1 message Sep 15, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Timertop - some improvements (3)

Hi,

Here we have a new and cleaned version of timertop. It now uses seq_file to get a more stable output.

Timertop is a small utility that gets some information to be useful for dynamic-tick patch, it consists of a kernel patch and a perl script. The kernel patch gathers information from timer functions ans stores it in a proc entry (/proc/timer_info).
The perl script parses it and shows in the screen the usage of timer functions in the system, including the timer count, pid and cmdline of the processes that started the timer. It shows also the Hz value (idea from pm-stats).

The idea is to know which applications or drivers are consuming timers and try to optimize them in order to get lower HZ values and save more power, at least in theory. So it is applicable over the dyn-tick patch.

The perl script has this output:

Timer Top v0.9.3
Ticks: 236 HZ
Address Count Freq(Hz) Function PID Command

c011f2b7 |38847164|  444.00|    process_timeout|6765  |cpufreq-applet  |
c011f2b7 |38847164|  444.00|    process_timeout|20327 |timer_top.pl    |
c011f2b7 |38847164|  444.00|    process_timeout|18304 |firefox-bin     |
c01be3b8 |44840   |    4.00|     commit_timeout|783   |kjournald       |
c011ad7b |5440294 |  172.00|         it_real_fn|5572  |Xorg            |
c028f061 |323612  |   44.00| neigh_periodic_tim|X     |                |

Some of the timers, of course, are only related to kernel so there is nothing in the process (PID and Command) column.

The System.map file must be in the script directory. The patch should apply over 2.6.13-mm1.

We hope that this can be useful.

We are open to comments, suggestions and review.

Daniel Petrini
---------------------
10LE - Linux
INdT - Manaus - Brazil

kernel/Makefile +1 -1
diff -uprN linux-2.6.12-orig/kernel/Makefile linux-dyn-tick/kernel/Makefile
@@ -30,7 +30,7 @@ obj-$(CONFIG_SYSFS) += ksysfs.o
 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
 obj-$(CONFIG_SECCOMP) += seccomp.o
-obj-$(CONFIG_NO_IDLE_HZ) += dyn-tick.o
+obj-$(CONFIG_NO_IDLE_HZ) += dyn-tick.o timer_top.o
 
 ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/timer.c +4 -0
diff -uprN linux-2.6.12-orig/kernel/timer.c linux-dyn-tick/kernel/timer.c
@@ -508,6 +508,9 @@ static inline void __run_timers(tvec_bas
 }
 
 #ifdef CONFIG_NO_IDLE_HZ
+extern struct timer_top_info top_info;
+extern int account_timer(unsigned int function,
+	       		struct timer_top_info * top_info);
 /*
  * Find out when the next timer event is due to happen. This
  * is used on S/390 to stop all activity when a cpus is idle.
@@ -571,6 +574,7 @@ found:
 				expires = nte->expires;
 		}
 	}
+	account_timer((unsigned int)nte->function, &top_info);
 	spin_unlock(&base->t_base.lock);
 	return expires;
 }
kernel/timer_top.c +139 -0

139 lines not on this page · raw message