Re: [PATCH 1/5] perf tools: Fix -C option for record command

Jiri Olsa
2013-02-25T22:04:03Z

On Mon, Feb 25, 2013 at 11:56:38AM -0700, David Ahern wrote:
> On 2/25/13 11:39 AM, Oleg Nesterov wrote:
> >To clarify, I am not trying to review this patch, I'd like to ask
> >the question...
> >
> >On 02/25, Jiri Olsa wrote:
> >>
> >>Currently the -C option does not work for record command,
> >>because of the targets mismatch when synthesizing threads.
> >>
> >>Fixing this by using proper target interface for the
> >>synthesize decision.
> >
> >OK, but my fix had the different goal. I thought that
> >
> > $ perf ... record -C0 sleep 1
> >
> >should attach the counter to the child process (workload) and set
> >event->cpu = 0 (instead of -1). With this patch we create the cpu
>
> If a target is given (-a, -C, -p or -t) that is what the data is
> collected for -- all cpus, a cpu, or one or more task ids. The
> workload in that case becomes a means for bounding the data
> collection (start and end points).
>
> If you want to collect events for a workload you just run
> perf-record -- workload.
>
> Last time I dug into it (which was 8-12 months ago) -C required -a
> to work properly. -a (system_wide) meaning collect events for all
> cpus and then -C meaning but only for this cpu. Perhaps Namyhung's
> target changes may have simplified fixing that as Jiri's patch
> suggests.

yes, that's what actually this patch fixies.. now you can run:

perf record -C 0 ls

and that will attach to cpu 0 only (same as '-a -C 0' before)

maybe we could consider having:

perf record -C 0 ls
- attaching to CPU 0 and ls workload pid

perf record -a -C 0 ls
- attaching to CPU 0 globaly

jirka