Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312270
b: refs/heads/master
c: 27f1861
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Jun 19, 2012
1 parent da6db2d commit cc3e513
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aff3f3f68ae6002a30543726b2ae48cafce109e6
refs/heads/master: 27f18617b01dbbc928e9bd3731d1766222fb7e0d
17 changes: 11 additions & 6 deletions trunk/tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,15 @@ const char *__perf_evsel__hw_name(u64 config)
return "unknown-hardware";
}

static int perf_evsel__hw_name(struct perf_evsel *evsel, char *bf, size_t size)
static int perf_evsel__add_modifiers(struct perf_evsel *evsel, char *bf, size_t size)
{
int colon = 0;
int colon = 0, r = 0;
struct perf_event_attr *attr = &evsel->attr;
int r = scnprintf(bf, size, "%s", __perf_evsel__hw_name(attr->config));
bool exclude_guest_default = false;

#define MOD_PRINT(context, mod) do { \
if (!attr->exclude_##context) { \
if (!colon) colon = r++; \
if (!colon) colon = ++r; \
r += scnprintf(bf + r, size - r, "%c", mod); \
} } while(0)

Expand All @@ -108,7 +107,7 @@ static int perf_evsel__hw_name(struct perf_evsel *evsel, char *bf, size_t size)

if (attr->precise_ip) {
if (!colon)
colon = r++;
colon = ++r;
r += scnprintf(bf + r, size - r, "%.*s", attr->precise_ip, "ppp");
exclude_guest_default = true;
}
Expand All @@ -119,10 +118,16 @@ static int perf_evsel__hw_name(struct perf_evsel *evsel, char *bf, size_t size)
}
#undef MOD_PRINT
if (colon)
bf[colon] = ':';
bf[colon - 1] = ':';
return r;
}

static int perf_evsel__hw_name(struct perf_evsel *evsel, char *bf, size_t size)
{
int r = scnprintf(bf, size, "%s", __perf_evsel__hw_name(evsel->attr.config));
return r + perf_evsel__add_modifiers(evsel, bf + r, size - r);
}

int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size)
{
int ret;
Expand Down

0 comments on commit cc3e513

Please sign in to comment.