[PATCH] sys-utils: fix readprofile on ppc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix inconsistency between kernel profiling and readprofile.
The range of kernel profiling is between _stext and _etext,
and readprofile tries to extract profiling for all the symbols in
/boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there
are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those
between _stext and _etext.

Signed-off-by: Matthias Koenig <mkoenig@xxxxxxx>
---
 sys-utils/readprofile.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 978e6c1..cd64334 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -325,6 +325,7 @@ main(int argc, char **argv) {
 	 */
 	while (fgets(mapline,S_LEN,map)) {
 		unsigned int this=0;
+		int done = 0;
 
 		if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name)!=3) {
 			fprintf(stderr,_("%s: %s(%i): wrong map line\n"),
@@ -333,12 +334,17 @@ main(int argc, char **argv) {
 		}
 		header_printed = 0;
 
-		/* 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 */
+		/* the kernel only profiles up to _etext */
+		if (!strcmp(next_name, "_etext"))
+			done = 1;
+		else {
+			/* 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 (indx >= len / sizeof(*buf)) {
 			fprintf(stderr, _("%s: profile address out of range. "
@@ -388,6 +394,8 @@ main(int argc, char **argv) {
 		strcpy(fn_name,next_name);
 
 		maplineno++;
+		if (done)
+			break;
 	}
 
 	/* clock ticks, out of kernel text - probably modules */
-- 
1.5.0.4.GIT

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux