mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cef (LKML)" <cef-lkml@optusnet.com.au>
To: linux-kernel@vger.kernel.org
Cc: William Lee Irwin III <wli@holomorphy.com>,
	"Randy.Dunlap" <rddunlap@osdl.org>
Subject: Re: [announce/OT] kerneltop ver. 0.7
Date: Mon, 24 May 2004 19:55:42 +1000	[thread overview]
Message-ID: <200405241955.43938.cef-lkml@optusnet.com.au> (raw)
In-Reply-To: <20040524053153.GM1833@holomorphy.com>

On Mon, 24 May 2004 15:31, William Lee Irwin III wrote:
> On Sun, May 23, 2004 at 09:50:27PM -0700, Randy.Dunlap wrote:
> > just a little note about kerneltop...
> > 'kerneltop' is similar to 'top', but shows only kernel function usage
> > (modules not included).
> > I have updated it a bit (now version 0.7) and made sure that it
> > works OK on Linux 2.6.x.
> > It's available here:
> > 	http://www.xenotime.net/linux/kerneltop/
>
> GRRR.. this tries to reset /proc/profile. Multiple megabytes of in-
> kernel memset() at a frequency of 1Hz are extremely unfriendly.

Following patch primes the buffer first time round (avoids huge total_ticks on 
first pass) and moves total_ticks to the end of the field header bar, saving 
an output line for useful data.

PS: If this keeps going, we should probably take this off-list or move to 
somewhere appropriate.

--- kerneltop.c-old	2004-05-24 19:44:35.000000000 +1000
+++ kerneltop.c	2004-05-24 19:48:40.000000000 +1000
@@ -266,7 +266,7 @@
  * heading looks like (3 lines):
 <uname -a>
 Sampling step: n | Address range: s_text_addr - e_text_addr
-address  function ..... date/time ...... ticks
+address  function ..... date/time ...... ticks (total_ticks)
  */
 static void heading (void)
 {
@@ -797,6 +797,11 @@
 
 	heading ();
 
+	printf ("... profiling ...\n"); // keep the user in suspense
+	len = profile_read (proFile, &buf); // allocates buf & returns its len
+	memset (freqs, 0, sizeof(int) * (text_lines + 1));
+	sleep (1);
+
     while (1) {		// get profile data, put it into symbol buckets, print
 	lastbuf = buf;
 	len = profile_read (proFile, &buf); // allocates buf & returns its len
@@ -809,7 +814,7 @@
 	time (&timer);
 	dttm = localtime (&timer);
 	vid_curpos (ROW_HEADINGS, 1);
-	printf (_("address  function ..... %d-%02d-%02d/%02d:%02d:%02d ...... 
ticks\n"),
+	printf (_("address  function ..... %d-%02d-%02d/%02d:%02d:%02d ...... 
ticks"),
 		dttm->tm_year + 1900, dttm->tm_mon + 1, dttm->tm_mday,
 		dttm->tm_hour, dttm->tm_min, dttm->tm_sec);
 
@@ -841,6 +846,9 @@
 		if (fnx >= 0)
 			freqs [fnx] += ticks;
 	}
+	// Print total on end of previous string
+	printf (" (%6i)\n", total_ticks);
+
 	/*
 	 * Optionally sort the top <prof_lines> entries.
 	 * Print the top entries.
@@ -863,9 +871,6 @@
 			textsym->textadr, textsym->textname, ticks);
 	}
 
-	/* trailer */
-	printf ("%08x %-40s %6i\n", 0, "total", total_ticks);
-
 	total_ticks = 0;
 	// clear freqs for next pass
 	memset (freqs, 0, sizeof(int) * (text_lines + 1));

-- 
 Stuart Young (aka Cef)
 cef-lkml@optusnet.com.au is for LKML and related email only

  reply	other threads:[~2004-05-24  9:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-24  4:50 Randy.Dunlap
2004-05-24  5:31 ` William Lee Irwin III
2004-05-24  9:55   ` Cef (LKML) [this message]
2004-05-24 21:49     ` Randy.Dunlap
2004-05-24 21:47   ` Randy.Dunlap
2004-05-24  5:53 ` Cef (LKML)
2004-05-24  6:00   ` William Lee Irwin III
2004-05-24  7:18     ` Cef (LKML)
2004-05-25 19:12     ` Pavel Machek
2004-05-24 23:20 Albert Cahalan

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=200405241955.43938.cef-lkml@optusnet.com.au \
    --to=cef-lkml@optusnet.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    --cc=wli@holomorphy.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

all inboxes | Powered by JetHome®