Re: [PATCH v3 3/4] perf record: Don't clear event's period if set by a term

Arnaldo Carvalho de Melo
2020-09-14T21:51:22Z

Em Mon, Sep 14, 2020 at 06:46:55PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Sep 11, 2020 at 07:56:54PM -0700, Ian Rogers escreveu:
> > If events in a group explicitly set a frequency or period with leader
> > sampling, don't disable the samples on those events.
> >
> > Prior to 5.8:
> > perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
> > would clear the attributes then apply the config terms. In commit
> > 5f34278867b7 leader sampling configuration was moved to after applying the
> > config terms, in the example, making the instructions' event have its period
> > cleared.
> > This change makes it so that sampling is only disabled if configuration
> > terms aren't present.
>
> Adrian, Jiri, can you please take a look a this and provide Reviewed-by
> or Acked-by tags?

Without this patch we have:

# perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.051 MB perf.data (6 samples) ]
#
# perf evlist -v
cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
instructions/period=2/: size: 120, config: 0x1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
#

So indeed the period=2 is being cleared for the second event in that
group.

- Arnaldo