public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: kan.liang@intel.com
Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com,
	linux-kernel@vger.kernel.org, jolsa@kernel.org,
	namhyung@kernel.org, adrian.hunter@intel.com,
	lukasz.odzioba@intel.com, ak@linux.intel.com
Subject: Re: [PATCH RFC V3 3/5] perf top: implement multithreading for perf_event__synthesize_threads
Date: Wed, 27 Sep 2017 13:44:52 +0200	[thread overview]
Message-ID: <20170927114452.GA29254@krava> (raw)
In-Reply-To: <1506370988-56587-4-git-send-email-kan.liang@intel.com>

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

  reply	other threads:[~2017-09-27 11:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 20:23 [PATCH RFC V3 0/5] perf top optimization kan.liang
2017-09-25 20:23 ` [PATCH RFC V3 1/5] perf tools: lock to protect namespaces and comm list kan.liang
2017-09-25 20:23 ` [PATCH RFC V3 2/5] perf tools: lock to protect comm_str rb tree kan.liang
2017-09-25 20:23 ` [PATCH RFC V3 3/5] perf top: implement multithreading for perf_event__synthesize_threads kan.liang
2017-09-27 11:44   ` Jiri Olsa [this message]
2017-09-25 20:23 ` [PATCH RFC V3 4/5] perf top: add option to set the number of thread for event synthesize kan.liang
2017-09-25 20:23 ` [PATCH RFC V3 5/5] perf top: switch back to overwrite mode kan.liang
2017-09-25 20:36   ` Andi Kleen
2017-09-27 12:00   ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170927114452.GA29254@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.odzioba@intel.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox