Re: [PATCH V2 4/5] perf record: synthesize event multithreading support
From: Jiri Olsa
Date: Wed Oct 18 2017 - 11:40:00 EST
On Wed, Oct 18, 2017 at 07:29:32AM -0700, kan.liang@xxxxxxxxx wrote:
SNIP
> +static int record__multithread_synthesize(struct record *rec,
> + struct machine *machine,
> + struct perf_tool *tool,
> + struct record_opts *opts)
> +{
> + int i, err, nr_thread = sysconf(_SC_NPROCESSORS_ONLN);
> + char name[PATH_MAX];
> + struct stat st;
> +
> + if (nr_thread <= 1)
> + return __machine__synthesize_threads(machine, tool,
> + &opts->target,
> + rec->evlist->threads,
> + process_synthesized_event,
> + opts->sample_address,
> + opts->proc_map_timeout,
> + 1);
^^^^^^^^^^^^^^^^^^
> +
> static int record__synthesize(struct record *rec, bool tail)
> {
> struct perf_session *session = rec->session;
> @@ -766,9 +856,16 @@ static int record__synthesize(struct record *rec, bool tail)
> perf_event__synthesize_guest_os, tool);
> }
>
> - err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
> - process_synthesized_event, opts->sample_address,
> - opts->proc_map_timeout, 1);
> + /* multithreading synthesize is only available for cpu monitoring */
> + if (target__has_cpu(&opts->target))
> + err = record__multithread_synthesize(rec, machine, tool, opts);
> + else
> + err = __machine__synthesize_threads(machine, tool,
> + &opts->target,
> + rec->evlist->threads,
> + process_synthesized_event,
> + opts->sample_address,
> + opts->proc_map_timeout, 1);
hum, this could be checked together with nr_thread in record__multithread_synthesize
jirka