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

From: Oleg Nesterov
Date: Mon Feb 25 2013 - 13:41:50 EST


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
counter and event->task == NULL (thanks for your private explanations
btw ;).

But note that (iirc, I didn't even try to read this code again)

$ perf ... record -a sleep 1

attaches the counter to the task, and I think that -a/C should be
consistent.


However,

> @@ -573,13 +573,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
> perf_event__synthesize_guest_os, tool);
> }
>
> - if (!opts->target.system_wide)
> + if (perf_target__has_task(&opts->target))
> err = perf_event__synthesize_thread_map(tool, evsel_list->threads,
> process_synthesized_event,
> machine);
> - else
> + else if (perf_target__has_cpu(&opts->target))
> err = perf_event__synthesize_threads(tool, process_synthesized_event,

I do agree, this should be changed too, because "-a sleep 1"
sets ->target.system_wide.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/