mirror of
https://github.com/LineageOS/android_kernel_samsung_msm8226.git
synced 2026-09-28 00:00:22 +02:00
Perf: Add event modifiers to perf output
Enhance the output from perf to indicate if the event had any user specified modifiers. e.g. if the event was r8:u, show the ":u" in the output as well. Change-Id: Iac9d9047f2cd8c17d81104fb39f7546c6b8af4b6 Signed-off-by: Ashwin Chaugule <ashwinc@codeaurora.org>
This commit is contained in:
@@ -297,9 +297,37 @@ const char *event_name(struct perf_evsel *evsel)
|
||||
{
|
||||
u64 config = evsel->attr.config;
|
||||
int type = evsel->attr.type;
|
||||
char *buf;
|
||||
size_t buf_sz;
|
||||
|
||||
if (evsel->name) {
|
||||
/* Make new space for the modifier bits. */
|
||||
buf_sz = strlen(evsel->name) + 3;
|
||||
buf = malloc(buf_sz);
|
||||
if (!buf)
|
||||
/*
|
||||
* Always return what was already in 'name'.
|
||||
*/
|
||||
return evsel->name;
|
||||
|
||||
strlcpy(buf, evsel->name, buf_sz);
|
||||
|
||||
free(evsel->name);
|
||||
|
||||
evsel->name = buf;
|
||||
|
||||
/* User mode profiling. */
|
||||
if (!evsel->attr.exclude_user && evsel->attr.exclude_kernel)
|
||||
strlcpy(&evsel->name[strlen(evsel->name)], ":u",
|
||||
buf_sz);
|
||||
/* Kernel mode profiling. */
|
||||
else if (!evsel->attr.exclude_kernel &&
|
||||
evsel->attr.exclude_user)
|
||||
strlcpy(&evsel->name[strlen(evsel->name)], ":k",
|
||||
buf_sz);
|
||||
|
||||
if (evsel->name)
|
||||
return evsel->name;
|
||||
}
|
||||
|
||||
return __event_name(type, config, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user