lkml.org 
[lkml]   [2004]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[util-linux] readprofile ignores the last element in /proc/profile
Date
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",

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.130 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site