public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Con Kolivas <kernel@kolivas.org>
To: Daniel Petrini <d.pensator@gmail.com>
Cc: tony@atomide.com, linux-kernel@vger.kernel.org,
	ck@vds.kolivas.org, tuukka.tikkanen@elektrobit.com,
	ilias.biris@indt.org.br
Subject: [PATCH] Timer Top tweaks
Date: Fri, 5 Aug 2005 14:05:50 +1000	[thread overview]
Message-ID: <200508051405.50529.kernel@kolivas.org> (raw)
In-Reply-To: <9268368b050804141525539666@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

On Fri, 5 Aug 2005 07:15 am, Daniel Petrini wrote:
> Hi,
>
> Here we have some support to have more tests on Dynamic Tick.
> We have some functions that exports timers information to a proc entry
> (/proc/top_info), in a kernel patch and a script that handles this
> info and give some output to analyse. We tried to make it less
> intrusive as possible.
>
> It is based in suggestions from Tony Lindgren.
>
> It is experimental and should evolve.
>
> Must be applied after 2.6.13-rc5-dtck-3.patch and 2.6.13-rc5.
>
> Usage: with kernel compiled with attached patch: "perl timer_top.pl
> 5", to have refresh time of 5s.

Yes that's very nice.

It's probably premature but here's a small patch to your timer_top patch. 

Cheers,
Con
---



[-- Attachment #2: timer_top_tweaks.patch --]
[-- Type: text/x-diff, Size: 4259 bytes --]

Index: linux-2.6.13-rc5-ck2/kernel/Makefile
===================================================================
--- linux-2.6.13-rc5-ck2.orig/kernel/Makefile	2005-08-05 13:41:26.000000000 +1000
+++ linux-2.6.13-rc5-ck2/kernel/Makefile	2005-08-05 13:49:23.000000000 +1000
@@ -7,7 +7,7 @@ obj-y     = sched.o fork.o exec_domain.o
 	    sysctl.o capability.o ptrace.o timer.o user.o \
 	    signal.o sys.o kmod.o workqueue.o pid.o \
 	    rcupdate.o intermodule.o extable.o params.o posix-timers.o \
-	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o timer_top.o
+	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o
 
 obj-$(CONFIG_FUTEX) += futex.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
@@ -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 <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
Index: linux-2.6.13-rc5-ck2/kernel/timer.c
===================================================================
--- linux-2.6.13-rc5-ck2.orig/kernel/timer.c	2005-08-05 13:41:26.000000000 +1000
+++ linux-2.6.13-rc5-ck2/kernel/timer.c	2005-08-05 13:57:23.000000000 +1000
@@ -509,7 +509,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);
+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.
Index: linux-2.6.13-rc5-ck2/kernel/timer_top.c
===================================================================
--- linux-2.6.13-rc5-ck2.orig/kernel/timer_top.c	2005-08-05 13:41:26.000000000 +1000
+++ linux-2.6.13-rc5-ck2/kernel/timer_top.c	2005-08-05 13:54:50.000000000 +1000
@@ -11,7 +11,6 @@
  * published by the Free Software Foundation.
  */
 
-
 #include <linux/list.h>
 #include <linux/proc_fs.h>
 #include <linux/module.h>
@@ -20,8 +19,8 @@ static LIST_HEAD(timer_list);
 
 struct timer_top_info {
 	unsigned int		func_pointer;
-	unsigned int long	counter;
-	struct list_head 	list;      	
+	unsigned long		counter;
+	struct list_head 	list;
 };
 
 struct timer_top_info top_info;
@@ -30,37 +29,38 @@ int account_timer(unsigned int function,
 {
 	struct timer_top_info *top;
 
-	list_for_each_entry (top, &timer_list, list) {
+	list_for_each_entry(top, &timer_list, list) {
 		/* if it is in the list increment its count */
 		if (top->func_pointer == function) {
-			top->counter += 1;
-			return 0;
+			top->counter++;
+			goto out;
 		}
 	}
-	
+
 	/* if you are here then it didnt find so inserts in the list */
 
 	top = kmalloc(sizeof(struct timer_top_info), GFP_KERNEL);
-	if (!top) 
+	if (!top)
 		return -ENOMEM;
 	top->func_pointer = function;
 	top->counter = 1;
 	list_add(&top->list, &timer_list);
 
+out:
 	return 0;
 }
 
 EXPORT_SYMBOL(account_timer);
 
 struct top_info_poll {
-  char value[18];
+	char value[18];
 };
 
 struct top_info_poll top_info_poll_dt;
 struct proc_dir_entry *top_info_file;
 
 static int proc_read_top_info(char *page, char **start, off_t off,
-                                int count, int *eof, void *data)
+				int count, int *eof, void *data)
 {
 	char aux[18];
 	struct timer_top_info *top;
@@ -69,21 +69,19 @@ static int proc_read_top_info(char *page
 
 	sprintf(page, "Function counter - %s\n", info_poll_data->value);
 
-	list_for_each_entry (top, &timer_list, list) {
+	list_for_each_entry(top, &timer_list, list) {
 		sprintf(aux, "%x %lu\n", top->func_pointer, top->counter);
 		strcat(page, aux);
 	}
 
 	return strlen(page);
- 
-} 
+}
 
 static int init_top_info(void)
 {
 	top_info_file = create_proc_entry("top_info", 0666, NULL);
-	if(top_info_file == NULL) {
-	  return -ENOMEM;
-	}
+	if (top_info_file == NULL)
+		return -ENOMEM;
 
 	strcpy(top_info_poll_dt.value, "Timer Top v0.9.1");
 
@@ -96,6 +94,3 @@ static int init_top_info(void)
 
 module_init(init_top_info);
 //module_exit();
-
-
-

  reply	other threads:[~2005-08-05  4:11 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-03  5:59 [PATCH] i386 No-Idle-Hz aka Dynamic-Ticks 3 Con Kolivas
2005-08-03 11:54 ` Jan De Luyck
2005-08-03 12:14   ` Con Kolivas
2005-08-03 14:23     ` Jan De Luyck
2005-08-04 15:03       ` Vojtech Pavlik
2005-08-05  5:12         ` Con Kolivas
2005-08-03 19:20 ` Jim MacBaine
2005-08-03 21:16   ` Con Kolivas
2005-08-03 22:22     ` Jim MacBaine
2005-08-03 22:52       ` Con Kolivas
2005-08-04  5:34         ` Jim MacBaine
2005-08-04  6:59           ` Jim MacBaine
2005-08-04  7:04             ` Con Kolivas
2005-08-04  7:12               ` Con Kolivas
2005-08-04  7:29                 ` Tony Lindgren
2005-08-10 20:04             ` Bill Davidsen
2005-08-14 19:47         ` Pavel Machek
2005-08-15  1:43           ` Zwane Mwaikambo
2005-08-15 12:52             ` Con Kolivas
2005-08-15 15:39               ` Zwane Mwaikambo
2005-08-03 19:54 ` Jeffrey Hundstad
2005-08-03 20:07   ` Valdis.Kletnieks
2005-08-03 21:13   ` Con Kolivas
2005-08-03 23:22 ` Christian Leber
2005-08-04 16:25   ` Marc Ballarin
2005-08-04  5:09 ` Jan De Luyck
2005-08-04  5:07   ` Con Kolivas
2005-08-04  5:34     ` Jan De Luyck
2005-08-04 21:15 ` [PATCH] Timer Top was: " Daniel Petrini
2005-08-05  4:05   ` Con Kolivas [this message]
2005-08-05  6:46   ` [ck] " Jens Axboe
2005-08-05 12:39     ` Daniel Petrini
2005-08-05 13:55       ` Daniel Petrini
2005-08-04 21:44 ` [PATCH] " Adrian Bunk
2005-08-04 22:12 ` Marc Ballarin
2005-08-05  0:31   ` Con Kolivas
2005-08-05  1:30 ` Paul
2005-08-05  3:25   ` Con Kolivas
2005-08-05 12:37 ` Srivatsa Vaddagiri
2005-08-05 13:08   ` Con Kolivas
2005-08-05 16:39     ` [PATCH] i386 No-Idle-Hz aka Dynamic-Ticks 4 Con Kolivas
2005-08-06 17:47       ` Adrian Bunk
2005-08-07  5:12         ` [PATCH] i386 No-Idle-Hz aka Dynamic-Ticks 5 Con Kolivas
2005-08-07 16:58           ` Srivatsa Vaddagiri
2005-08-07 23:51             ` Con Kolivas
2005-08-08  1:20               ` Kyle Moffett
2005-08-08  1:30                 ` Con Kolivas
2005-08-08  1:45                   ` [ck] " Gabriel Devenyi
2005-08-08  2:44                   ` Srivatsa Vaddagiri
2005-08-08  7:05                     ` Nigel Cunningham
2005-08-08  7:38             ` Tony Lindgren
2005-08-08 15:06               ` Srivatsa Vaddagiri
2005-08-09 19:36             ` George Anzinger
2005-08-10 14:05               ` Srivatsa Vaddagiri
2005-08-10 22:37                 ` George Anzinger
2005-08-11 21:33                   ` Bill Davidsen
2005-08-12 15:13                     ` George Anzinger
2005-08-08 15:08           ` Folkert van Heusden
2005-08-08 15:16             ` Daniel Petrini
2005-08-08  7:26   ` [PATCH] i386 No-Idle-Hz aka Dynamic-Ticks 3 Tony Lindgren
2005-08-08 14:54     ` Srivatsa Vaddagiri
2005-08-08 15:20       ` Tony Lindgren
2005-08-09 14:22         ` Zwane Mwaikambo
2005-08-10  7:46           ` Tony Lindgren
2005-08-09 20:05     ` George Anzinger
2005-08-09 20:22       ` Daniel Petrini
2005-08-10  8:02       ` Tony Lindgren
2005-08-10 22:40         ` George Anzinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200508051405.50529.kernel@kolivas.org \
    --to=kernel@kolivas.org \
    --cc=ck@vds.kolivas.org \
    --cc=d.pensator@gmail.com \
    --cc=ilias.biris@indt.org.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=tuukka.tikkanen@elektrobit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox