diff options
author | Avi Kivity <avi@redhat.com> | 2011-12-25 08:44:43 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-12-27 04:22:24 -0500 |
commit | 9e31905f293ae84e4f120ed9e414031eaefa0bdf (patch) | |
tree | 153204ff0dca820e760007bc24075ec7fb46a276 /tools/perf/util/evsel.c | |
parent | ff5c2c0316ff0e3e2dba3ca14167d994453df093 (diff) | |
parent | b3d9468a8bd218a695e3a0ff112cd4efd27b670a (diff) |
Merge remote-tracking branch 'tip/perf/core' into kvm-updates/3.3
* tip/perf/core: (66 commits)
perf, x86: Expose perf capability to other modules
perf, x86: Implement arch event mask as quirk
x86, perf: Disable non available architectural events
jump_label: Provide jump_label_key initializers
jump_label, x86: Fix section mismatch
perf, core: Rate limit perf_sched_events jump_label patching
perf: Fix enable_on_exec for sibling events
perf: Remove superfluous arguments
perf, x86: Prefer fixed-purpose counters when scheduling
perf, x86: Fix event scheduler for constraints with overlapping counters
perf, x86: Implement event scheduler helper functions
perf: Avoid a useless pmu_disable() in the perf-tick
x86/tools: Add decoded instruction dump mode
x86: Update instruction decoder to support new AVX formats
x86/tools: Fix insn_sanity message outputs
x86/tools: Fix instruction decoder message output
x86: Fix instruction decoder to handle grouped AVX instructions
x86/tools: Fix Makefile to build all test tools
perf test: Soft errors shouldn't stop the "Validate PERF_RECORD_" test
perf test: Validate PERF_RECORD_ events and perf_sample fields
...
Signed-off-by: Avi Kivity <avi@redhat.com>
* commit 'b3d9468a8bd218a695e3a0ff112cd4efd27b670a': (66 commits)
perf, x86: Expose perf capability to other modules
perf, x86: Implement arch event mask as quirk
x86, perf: Disable non available architectural events
jump_label: Provide jump_label_key initializers
jump_label, x86: Fix section mismatch
perf, core: Rate limit perf_sched_events jump_label patching
perf: Fix enable_on_exec for sibling events
perf: Remove superfluous arguments
perf, x86: Prefer fixed-purpose counters when scheduling
perf, x86: Fix event scheduler for constraints with overlapping counters
perf, x86: Implement event scheduler helper functions
perf: Avoid a useless pmu_disable() in the perf-tick
x86/tools: Add decoded instruction dump mode
x86: Update instruction decoder to support new AVX formats
x86/tools: Fix insn_sanity message outputs
x86/tools: Fix instruction decoder message output
x86: Fix instruction decoder to handle grouped AVX instructions
x86/tools: Fix Makefile to build all test tools
perf test: Soft errors shouldn't stop the "Validate PERF_RECORD_" test
perf test: Validate PERF_RECORD_ events and perf_sample fields
...
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d7915d4e77cb..ee68d6944e61 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -63,6 +63,76 @@ struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx) | |||
63 | return evsel; | 63 | return evsel; |
64 | } | 64 | } |
65 | 65 | ||
66 | void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts) | ||
67 | { | ||
68 | struct perf_event_attr *attr = &evsel->attr; | ||
69 | int track = !evsel->idx; /* only the first counter needs these */ | ||
70 | |||
71 | attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; | ||
72 | attr->inherit = !opts->no_inherit; | ||
73 | attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | | ||
74 | PERF_FORMAT_TOTAL_TIME_RUNNING | | ||
75 | PERF_FORMAT_ID; | ||
76 | |||
77 | attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID; | ||
78 | |||
79 | /* | ||
80 | * We default some events to a 1 default interval. But keep | ||
81 | * it a weak assumption overridable by the user. | ||
82 | */ | ||
83 | if (!attr->sample_period || (opts->user_freq != UINT_MAX && | ||
84 | opts->user_interval != ULLONG_MAX)) { | ||
85 | if (opts->freq) { | ||
86 | attr->sample_type |= PERF_SAMPLE_PERIOD; | ||
87 | attr->freq = 1; | ||
88 | attr->sample_freq = opts->freq; | ||
89 | } else { | ||
90 | attr->sample_period = opts->default_interval; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | if (opts->no_samples) | ||
95 | attr->sample_freq = 0; | ||
96 | |||
97 | if (opts->inherit_stat) | ||
98 | attr->inherit_stat = 1; | ||
99 | |||
100 | if (opts->sample_address) { | ||
101 | attr->sample_type |= PERF_SAMPLE_ADDR; | ||
102 | attr->mmap_data = track; | ||
103 | } | ||
104 | |||
105 | if (opts->call_graph) | ||
106 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | ||
107 | |||
108 | if (opts->system_wide) | ||
109 | attr->sample_type |= PERF_SAMPLE_CPU; | ||
110 | |||
111 | if (opts->sample_id_all_avail && | ||
112 | (opts->sample_time || opts->system_wide || | ||
113 | !opts->no_inherit || opts->cpu_list)) | ||
114 | attr->sample_type |= PERF_SAMPLE_TIME; | ||
115 | |||
116 | if (opts->raw_samples) { | ||
117 | attr->sample_type |= PERF_SAMPLE_TIME; | ||
118 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
119 | attr->sample_type |= PERF_SAMPLE_CPU; | ||
120 | } | ||
121 | |||
122 | if (opts->no_delay) { | ||
123 | attr->watermark = 0; | ||
124 | attr->wakeup_events = 1; | ||
125 | } | ||
126 | |||
127 | attr->mmap = track; | ||
128 | attr->comm = track; | ||
129 | |||
130 | if (opts->target_pid == -1 && opts->target_tid == -1 && !opts->system_wide) { | ||
131 | attr->disabled = 1; | ||
132 | attr->enable_on_exec = 1; | ||
133 | } | ||
134 | } | ||
135 | |||
66 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) | 136 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) |
67 | { | 137 | { |
68 | int cpu, thread; | 138 | int cpu, thread; |