From: Daniel Petrini <d.pensator@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tony@atomide.com, Con Kolivas <kernel@kolivas.org>
Subject: Timertop - update
Date: Mon, 8 Aug 2005 10:45:45 -0400 [thread overview]
Message-ID: <9268368b050808074579501f86@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
Hi,
Here we have a slightly update for timertop script, it now shows the
ticks in Hz (borrowed from Tony's pmstats - let me know if I shouldn't
:-) ) and some cleanups.
The timertop kernel patch is the same, tested for 2.6.13-rc5-dtck-5.patch.
I'm open to suggestions on what to aggregate in that utility.
In my system, a Dell Latitude D600, dyn tick is working ok. IT has 50
ticks in complete desktop environment.
Regards,
Daniel
--
10LE - Linux
INdT - Manaus - Brazil
[-- Attachment #2: timer_top3-20050805.patch --]
[-- Type: text/x-patch, Size: 4167 bytes --]
diff -uprN linux-2.6.12-orig/kernel/Makefile linux-dyn-tick/kernel/Makefile
--- linux-2.6.12-orig/kernel/Makefile 2005-08-05 09:33:24.000000000 -0400
+++ linux-dyn-tick/kernel/Makefile 2005-08-05 09:28:18.000000000 -0400
@@ -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
diff -uprN linux-2.6.12-orig/kernel/timer.c linux-dyn-tick/kernel/timer.c
--- linux-2.6.12-orig/kernel/timer.c 2005-08-05 09:33:31.000000000 -0400
+++ linux-dyn-tick/kernel/timer.c 2005-08-05 09:38:33.000000000 -0400
@@ -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;
}
diff -uprN linux-2.6.12-orig/kernel/timer_top.c linux-dyn-tick/kernel/timer_top.c
--- linux-2.6.12-orig/kernel/timer_top.c 1969-12-31 20:00:00.000000000 -0400
+++ linux-dyn-tick/kernel/timer_top.c 2005-08-05 09:28:38.000000000 -0400
@@ -0,0 +1,108 @@
+/*
+ * kernel/timer_top.c
+ *
+ * Export Timers information to /proc/top_info
+ *
+ * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus
+ * Written by Daniel Petrini <d.pensator@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+
+#include <linux/list.h>
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+
+static LIST_HEAD(timer_list);
+
+struct timer_top_info {
+ unsigned int func_pointer;
+ unsigned long counter;
+ struct list_head list;
+};
+
+struct timer_top_info top_info;
+
+static spinlock_t timer_lock = SPIN_LOCK_UNLOCKED;
+static unsigned long flags;
+
+
+int account_timer(unsigned int function, struct timer_top_info * top_info)
+{
+ struct timer_top_info *top;
+
+ spin_lock_irqsave(&timer_lock, flags);
+
+ list_for_each_entry(top, &timer_list, list) {
+ /* if it is in the list increment its count */
+ if (top->func_pointer == function) {
+ top->counter++;
+ spin_unlock_irqrestore(&timer_lock, flags);
+ goto out;
+ }
+ }
+
+ /* if you are here then it didnt find so inserts in the list */
+
+ top = kmalloc(sizeof(struct timer_top_info), GFP_ATOMIC);
+ if (!top)
+ return -ENOMEM;
+ top->func_pointer = function;
+ top->counter = 1;
+ list_add(&top->list, &timer_list);
+
+ spin_unlock_irqrestore(&timer_lock, flags);
+
+out:
+ return 0;
+}
+
+EXPORT_SYMBOL(account_timer);
+
+struct top_info_poll {
+ char value[18];
+};
+
+static struct top_info_poll top_info_poll_dt;
+static 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)
+{
+ char aux[18];
+ struct timer_top_info *top;
+
+ struct top_info_poll *info_poll_data=(struct top_info_poll *)data;
+
+ sprintf(page, "Function counter - %s\n", info_poll_data->value);
+
+ 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;
+ }
+
+ strcpy(top_info_poll_dt.value, "Timer Top v0.9.1");
+
+ top_info_file->data = &top_info_poll_dt;
+ top_info_file->read_proc = &proc_read_top_info;
+ top_info_file->owner = THIS_MODULE;
+
+ return 0;
+}
+
+module_init(init_top_info);
+//module_exit();
[-- Attachment #3: timer_top.pl --]
[-- Type: application/x-perl, Size: 2980 bytes --]
next reply other threads:[~2005-08-08 14:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-08 14:45 Daniel Petrini [this message]
2005-08-08 16:26 ` Timertop - update Jan De Luyck
2005-08-08 17:25 ` Daniel Petrini
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=9268368b050808074579501f86@mail.gmail.com \
--to=d.pensator@gmail.com \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.