Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740636

Re: [PATCH RFC V3 3/5] perf top: implement multithreading for perf_event__synthesize_threads

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC V3 3/5] perf top: implement multithreading for perf_event__synthesize_threads
Date 2017-09-27 13:50 +0200
Message-ID <uuj0L-1P9-23@gated-at.bofh.it> (permalink)
References <utIaS-2VS-11@gated-at.bofh.it> <utIaS-2VS-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH RFC V3 3/5] perf top: implement multithreading for  perf_event__synthesize_threads Jiri Olsa <jolsa@redhat.com> - 2017-09-27 13:50 +0200

csiph-web