On Mon, Sep 25, 2017 at 01:23:06PM -0700, [email protected] wrote:

SNIP

> +
> +int perf_event__synthesize_threads(struct perf_tool *tool,
> +                                perf_event__handler_t process,
> +                                struct machine *machine,
> +                                bool mmap_data,
> +                                unsigned int proc_map_timeout,
> +                                unsigned int nr_threads_synthesize)
> +{
> +     struct synthesize_threads_arg *args = NULL;
> +     pthread_t *synthesize_threads = NULL;
> +     char proc_path[PATH_MAX];
> +     struct dirent **dirent;
> +     int num_per_thread;
> +     int m, n, i, j;
> +     int thread_nr;
> +     int base = 0;
> +     int err = -1;
> +
> +
> +     if (machine__is_default_guest(machine))
> +             return 0;
> +
> +     snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
> +     n = scandir(proc_path, &dirent, 0, alphasort);
> +     if (n < 0)
> +             return err;
> +
> +     thread_nr = nr_threads_synthesize;
> +     if (thread_nr <= 0)
> +             thread_nr = 1;

given the number of callers with 'nr_threads_synthesize == 1',
could you just make it the special case in here, like:

        if (thread_nr == 1)
                return __perf_event__synthesize_threads

looks like all the args are ready at this time

thanks,
jirka

Reply via email to