lkml.org 
[lkml]   [2017]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC V3 3/5] perf top: implement multithreading for perf_event__synthesize_threads
On Mon, Sep 25, 2017 at 01:23:06PM -0700, kan.liang@intel.com 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

\
 
 \ /
  Last update: 2017-09-27 13:45    [W:0.076 / U:2.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site