Hi Andi,
2014-05-30 (금), 14:50 -0700, Andi Kleen:
> From: Andi Kleen <[email protected]>
>
> Fix the logic to allow overriding event default periods with -c or -F
> on the command line. I'm not sure I understand this if() fully, but
> this change makes all cases I tested work (tracepoint with default, default,
> ,-c, -F)
Are you sure you tested all cases after this patch applied?
When I apply it, it doesn't record any samples..
$ perf record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.309 MB perf.data
(~13494 samples) ]
$ perf report --stdio
Error:
The perf.data file has no samples!
# To display the perf.data header info,
# please use --header/--header-only options.
$ perf evlist -F
cycles: sample_freq=0
Thanks,
Namhyung
>
> This fixed specifying -c / -F with json event list events,
> which have a default period. It should do the same
> for trace point events.
>
> Cc: [email protected]
> v2: Simplify, just change || to &&
> Signed-off-by: Andi Kleen <[email protected]>
> ---
> tools/perf/util/evsel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 5c28d82..d9ceede 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -592,7 +592,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
> * We default some events to a 1 default interval. But keep
> * it a weak assumption overridable by the user.
> */
> - if (!attr->sample_period || (opts->user_freq != UINT_MAX &&
> + if (!attr->sample_period && (opts->user_freq != UINT_MAX &&
> opts->user_interval != ULLONG_MAX)) {
> if (opts->freq) {
> perf_evsel__set_sample_bit(evsel, PERIOD);
I saw samples.
Oh well we can just drop it. The only difference is that the
event list cannot set a period then.
It's as broken as before.
-Andi
--
[email protected] -- Speaking for myself only
On Wed, 4 Jun 2014 09:59:30 -0700, Andi Kleen wrote:
> I saw samples.
>
> Oh well we can just drop it. The only difference is that the
> event list cannot set a period then.
I tested with a downloaded event, and it does have samples. But the
frequency could not be changed even with your patch.
$ perf record -a -e uops_retired.all -F 4000 sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.327 MB perf.data (~14281 samples) ]
$ perf evlist -F
cpu/uops_retired.all/: sample_freq=2000003
>
> It's as broken as before.
At least, it worked well for events don't have a default sample
freq/period which means all but tracepoint events. For tracepoint
events, it makes little sense to change the default so I decided not to
touch it.
But with your change, the downloaded events might have a default
freq/period setting now. So I'd like to make it right. I'll send a fix
for this right soon.
Thanks,
Namhyung