Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339026
b: refs/heads/master
c: cac2142
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Nov 14, 2012
1 parent 8bb56b1 commit 61c5f38
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 29 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: 6064803313bad9ae4cae233a9d56678adb2b6e7c
refs/heads/master: cac21425578abddc4e9f529845832a57ba27ce0f
8 changes: 6 additions & 2 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,15 @@ static int perf_record__open(struct perf_record *rec)
struct perf_record_opts *opts = &rec->opts;
int rc = 0;

perf_evlist__config_attrs(evlist, opts);

/*
* Set the evsel leader links before we configure attributes,
* since some might depend on this info.
*/
if (opts->group)
perf_evlist__set_leader(evlist);

perf_evlist__config_attrs(evlist, opts);

list_for_each_entry(pos, &evlist->entries, node) {
struct perf_event_attr *attr = &pos->attr;
/*
Expand Down
11 changes: 4 additions & 7 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ static struct stats runtime_itlb_cache_stats[MAX_NR_CPUS];
static struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS];
static struct stats walltime_nsecs_stats;

static int create_perf_stat_counter(struct perf_evsel *evsel,
struct perf_evsel *first)
static int create_perf_stat_counter(struct perf_evsel *evsel)
{
struct perf_event_attr *attr = &evsel->attr;
bool exclude_guest_missing = false;
Expand All @@ -153,7 +152,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
return 0;
}

if (!perf_target__has_task(&target) && (!group || evsel == first)) {
if (!perf_target__has_task(&target) && (!evsel->leader)) {
attr->disabled = 1;
attr->enable_on_exec = 1;
}
Expand Down Expand Up @@ -272,7 +271,7 @@ static int read_counter(struct perf_evsel *counter)
static int __run_perf_stat(int argc __maybe_unused, const char **argv)
{
unsigned long long t0, t1;
struct perf_evsel *counter, *first;
struct perf_evsel *counter;
int status = 0;
int child_ready_pipe[2], go_pipe[2];
const bool forks = (argc > 0);
Expand Down Expand Up @@ -332,10 +331,8 @@ static int __run_perf_stat(int argc __maybe_unused, const char **argv)
if (group)
perf_evlist__set_leader(evsel_list);

first = perf_evlist__first(evsel_list);

list_for_each_entry(counter, &evsel_list->entries, node) {
if (create_perf_stat_counter(counter, first) < 0) {
if (create_perf_stat_counter(counter) < 0) {
/*
* PPC returns ENXIO for HW counters until 2.6.37
* (behavior changed with commit b0a873e).
Expand Down
4 changes: 1 addition & 3 deletions trunk/tools/perf/tests/attr/test-record-group1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ config=1
sample_type=327
mmap=0
comm=0
# TODO this is disabled for --group option, enabled otherwise
# check why..
enable_on_exec=1
enable_on_exec=0
6 changes: 2 additions & 4 deletions trunk/tools/perf/tests/attr/test-stat-group1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ group_fd=-1
fd=2
group_fd=1
config=1
# TODO both disabled and enable_on_exec are disabled for --group option,
# enabled otherwise, check why..
disabled=1
enable_on_exec=1
disabled=0
enable_on_exec=0
2 changes: 1 addition & 1 deletion trunk/tools/perf/tests/open-syscall-tp-fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int test__syscall_open_tp_fields(void)
goto out_delete_evlist;
}

perf_evsel__config(evsel, &opts, evsel);
perf_evsel__config(evsel, &opts);

evlist->threads->map[0] = getpid();

Expand Down
6 changes: 2 additions & 4 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
void perf_evlist__config_attrs(struct perf_evlist *evlist,
struct perf_record_opts *opts)
{
struct perf_evsel *evsel, *first;
struct perf_evsel *evsel;

if (evlist->cpus->map[0] < 0)
opts->no_inherit = true;

first = perf_evlist__first(evlist);

list_for_each_entry(evsel, &evlist->entries, node) {
perf_evsel__config(evsel, opts, first);
perf_evsel__config(evsel, opts);

if (evlist->nr_entries > 1)
evsel->attr.sample_type |= PERF_SAMPLE_ID;
Expand Down
8 changes: 3 additions & 5 deletions trunk/tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ const char *perf_evsel__name(struct perf_evsel *evsel)
return evsel->name ?: "unknown";
}

void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
struct perf_evsel *first)
void perf_evsel__config(struct perf_evsel *evsel,
struct perf_record_opts *opts)
{
struct perf_event_attr *attr = &evsel->attr;
int track = !evsel->idx; /* only the first counter needs these */
Expand Down Expand Up @@ -486,10 +486,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
attr->mmap = track;
attr->comm = track;

if (perf_target__none(&opts->target) &&
(!opts->group || evsel == first)) {
if (perf_target__none(&opts->target) && (!evsel->leader))
attr->enable_on_exec = 1;
}
}

int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
Expand Down
3 changes: 1 addition & 2 deletions trunk/tools/perf/util/evsel.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ void perf_evsel__exit(struct perf_evsel *evsel);
void perf_evsel__delete(struct perf_evsel *evsel);

void perf_evsel__config(struct perf_evsel *evsel,
struct perf_record_opts *opts,
struct perf_evsel *first);
struct perf_record_opts *opts);

bool perf_evsel__is_cache_op_valid(u8 type, u8 op);

Expand Down

0 comments on commit 61c5f38

Please sign in to comment.