linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf buildid-list: Show running kernel build id fix
@ 2015-11-27 13:48 Michael Petlan
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Petlan @ 2015-11-27 13:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa,
	平松雅巳 / HIRAMATU,MASAMI,
	linux-perf-users@vger.kernel.org

Hi all,

I have noticed that the '--kernel' option of perf buildid-list
tool has been broken, so no buildid is printed.

The attached patch should address the issue.

I have tested it against the latest version of Linus' tree.
Nothing wrong should be caused by this change, since in the
other cases when the function is called, no one cares about
the return value.

Michael


Michael Petlan (1):
  perf buildid-list: Show running kernel build id fix

 tools/perf/util/build-id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] perf buildid-list: Show running kernel build id fix
@ 2015-11-27 13:48 Michael Petlan
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Petlan @ 2015-11-27 13:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa,
	平松雅巳 / HIRAMATU,MASAMI,
	linux-perf-users@vger.kernel.org

The --kernel option of perf buildid-list tool should show the running
kernel buildid.  The functionality has been lost during other changes
of the related code.   The build_id__sprintf() function should return
length of the build-id string,  but it was the length of the build-id
raw data instead. Due to that, some return value checking caused that
the final string was not printed out.

With this patch the build_id__sprintf() returns the correct value, so
the --kernel option works again.

Before:

	# perf buildid-list --kernel
	#

After:

	# perf buildid-list --kernel
	972c1edab5bdc06cc224af45d510af662a3c6972
	#

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
 tools/perf/util/build-id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 217b5a6..6a7e273 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -91,7 +91,7 @@ int build_id__sprintf(const u8 *build_id, int len, char *bf)
 		bid += 2;
 	}
 
-	return raw - build_id;
+	return (bid - bf) + 1;
 }
 
 int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id)

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

end of thread, other threads:[~2015-11-27 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27 13:48 [PATCH] perf buildid-list: Show running kernel build id fix Michael Petlan
  -- strict thread matches above, loose matches on Subject: below --
2015-11-27 13:48 Michael Petlan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).