Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310584
b: refs/heads/master
c: 79695e1
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed May 30, 2012
1 parent 1c6be29 commit 0062b3d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 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: 107baecaca0b2843f1a0464701b253e51ef6f0e2
refs/heads/master: 79695e1bb65ba0e21488c360a1bed6e358354aaa
8 changes: 4 additions & 4 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ static int add_default_attributes(void)
return 0;

if (!evsel_list->nr_entries) {
if (perf_evlist__add_attrs_array(evsel_list, default_attrs) < 0)
if (perf_evlist__add_default_attrs(evsel_list, default_attrs) < 0)
return -1;
}

Expand All @@ -1139,21 +1139,21 @@ static int add_default_attributes(void)
return 0;

/* Append detailed run extra attributes: */
if (perf_evlist__add_attrs_array(evsel_list, detailed_attrs) < 0)
if (perf_evlist__add_default_attrs(evsel_list, detailed_attrs) < 0)
return -1;

if (detailed_run < 2)
return 0;

/* Append very detailed run extra attributes: */
if (perf_evlist__add_attrs_array(evsel_list, very_detailed_attrs) < 0)
if (perf_evlist__add_default_attrs(evsel_list, very_detailed_attrs) < 0)
return -1;

if (detailed_run < 3)
return 0;

/* Append very, very detailed run extra attributes: */
return perf_evlist__add_attrs_array(evsel_list, very_very_detailed_attrs);
return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs);
}

int cmd_stat(int argc, const char **argv, const char *prefix __used)
Expand Down
11 changes: 11 additions & 0 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ int perf_evlist__add_attrs(struct perf_evlist *evlist,
return -1;
}

int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs)
{
size_t i;

for (i = 0; i < nr_attrs; i++)
event_attr_init(attrs + i);

return perf_evlist__add_attrs(evlist, attrs, nr_attrs);
}

static int trace_event__id(const char *evname)
{
char *filename, *colon;
Expand Down
4 changes: 4 additions & 0 deletions trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
int perf_evlist__add_default(struct perf_evlist *evlist);
int perf_evlist__add_attrs(struct perf_evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs);
int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs);
int perf_evlist__add_tracepoints(struct perf_evlist *evlist,
const char *tracepoints[], size_t nr_tracepoints);
int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
Expand All @@ -62,6 +64,8 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,

#define perf_evlist__add_attrs_array(evlist, array) \
perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
#define perf_evlist__add_default_attrs(evlist, array) \
__perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array))

#define perf_evlist__add_tracepoints_array(evlist, array) \
perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
Expand Down

0 comments on commit 0062b3d

Please sign in to comment.