public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [util-linux] readprofile ignores the last element in /proc/profile
@ 2004-08-24 15:22 mita akinobu
  2004-08-29 16:22 ` William Lee Irwin III
  0 siblings, 1 reply; 16+ messages in thread
From: mita akinobu @ 2004-08-24 15:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andries Brouwer, Alessandro Rubini

Hello,

The readprofile command does not print the number of clock ticks about
the last element in profiling buffer.

Since the number of clock ticks which occur on the module functions is
as same as the value of the last element of prof_buffer[]. when many
ticks occur on there, some users who browsing the output of readprofile
may overlook the fact that the bottle-neck may exist in the modules.

I create the patch which enable to print clock ticks of the last
element as "*unknown*".

# readprofile
 77843 poll_idle                                1526.3333
     1 cpu_idle                                   0.0043
 [...]
     4 schedule_timeout                           0.0209
     2 *unknown*
108494 total                                      0.0385

If the clock ticks of '*unknown*' is large, it is highly recommended
to use OProfile, or to retry readprofile after compiling suspicious
modules into the kernel.

Mr.Brouwer, Could you apply this patch against util-linux-2.12a?


--- util-linux-2.12a/sys-utils/readprofile.c.orig	2004-08-24 23:11:16.383760112 +0900
+++ util-linux-2.12a/sys-utils/readprofile.c	2004-08-24 23:15:03.780190600 +0900
@@ -145,6 +145,7 @@ main(int argc, char **argv) {
 	int maplineno=1;
 	int popenMap;   /* flag to tell if popen() has been used */
 	int header_printed;
+	int end_of_text=0;
 
 #define next (current^1)
 
@@ -314,7 +315,7 @@ main(int argc, char **argv) {
 	/*
 	 * Main loop.
 	 */
-	while (fgets(mapline,S_LEN,map)) {
+	while (!end_of_text && fgets(mapline,S_LEN,map)) {
 		unsigned int this=0;
 
 		if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name)!=3) {
@@ -327,9 +328,8 @@ main(int argc, char **argv) {
 		/* ignore any LEADING (before a '[tT]' symbol is found)
 		   Absolute symbols */
 		if ((*mode == 'A' || *mode == '?') && total == 0) continue;
-		if (*mode != 'T' && *mode != 't' &&
-		    *mode != 'W' && *mode != 'w')
-			break;	/* only text is profiled */
+		if (!strcmp(next_name, "_etext"))
+			end_of_text = 1;
 
 		if (indx >= len / sizeof(*buf)) {
 			fprintf(stderr, _("%s: profile address out of range. "
@@ -367,6 +367,9 @@ main(int argc, char **argv) {
 
 		maplineno++;
 	}
+	/* clock ticks, out of kernel text */
+	printf("%6i %s\n", buf[len/sizeof(*buf)-1], "*unknown*");
+
 	/* trailer */
 	if (optVerbose)
 		printf("%016x %-40s %6i %8.4f\n",



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-09-01 16:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-24 15:22 [util-linux] readprofile ignores the last element in /proc/profile mita akinobu
2004-08-29 16:22 ` William Lee Irwin III
2004-08-29 18:41   ` William Lee Irwin III
2004-08-29 19:26     ` Andries Brouwer
2004-08-29 21:23       ` William Lee Irwin III
2004-08-29 21:26         ` William Lee Irwin III
2004-08-29 23:25         ` Andries Brouwer
2004-08-30  0:26           ` William Lee Irwin III
2004-08-30 18:27   ` Paulo Marques
2004-08-30 20:48     ` William Lee Irwin III
2004-08-31 16:45   ` mita akinobu
2004-08-31 17:21     ` mita akinobu
2004-08-31 19:25     ` William Lee Irwin III
2004-08-31 19:45       ` William Lee Irwin III
2004-09-01 16:09         ` mita akinobu
2004-09-01 16:27           ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox