mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Kyle Meyer <meyerk@hpe.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org,
	Russ Anderson <russ.anderson@hpe.com>,
	Kyle Meyer <kyle.meyer@hpe.com>
Subject: Re: [PATCH v2 1/6] perf: Refactor svg_build_topology_map
Date: Fri, 16 Aug 2019 11:05:14 +0200	[thread overview]
Message-ID: <20190816090514.GB20709@krava> (raw)
In-Reply-To: <20190814203824.204765-1-meyerk@stormcage.eag.rdlabs.hpecorp.net>

On Wed, Aug 14, 2019 at 03:38:24PM -0500, Kyle Meyer wrote:

SNIP

> diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
> index ae6a534a7a80..1beeb7291361 100644
> --- a/tools/perf/util/svghelper.c
> +++ b/tools/perf/util/svghelper.c
> @@ -751,38 +751,37 @@ static int str_to_bitmap(char *s, cpumask_t *b)
>  	return ret;
>  }
>  
> -int svg_build_topology_map(char *sib_core, int sib_core_nr,
> -			   char *sib_thr, int sib_thr_nr)
> +int svg_build_topology_map(struct perf_env *env)
>  {
>  	int i;
>  	struct topology t;
>  
> -	t.sib_core_nr = sib_core_nr;
> -	t.sib_thr_nr = sib_thr_nr;
> -	t.sib_core = calloc(sib_core_nr, sizeof(cpumask_t));
> -	t.sib_thr = calloc(sib_thr_nr, sizeof(cpumask_t));
> +	t.sib_core_nr = env->nr_sibling_cores;
> +	t.sib_thr_nr = env->nr_sibling_threads;
> +	t.sib_core = calloc(env->nr_sibling_cores, sizeof(cpumask_t));
> +	t.sib_thr = calloc(env->nr_sibling_threads, sizeof(cpumask_t));
>  
>  	if (!t.sib_core || !t.sib_thr) {
>  		fprintf(stderr, "topology: no memory\n");
>  		goto exit;
>  	}
>  
> -	for (i = 0; i < sib_core_nr; i++) {
> -		if (str_to_bitmap(sib_core, &t.sib_core[i])) {
> +	for (i = 0; i < env->nr_sibling_cores; i++) {
> +		if (str_to_bitmap(env->sibling_cores, &t.sib_core[i])) {
>  			fprintf(stderr, "topology: can't parse siblings map\n");
>  			goto exit;
>  		}
>  
> -		sib_core += strlen(sib_core) + 1;
> +		env->sibling_cores += strlen(env->sibling_cores) + 1;

so this will actualy change env->sibling_cores in the header,
I guess thats not a problem for timechart, but might cause some
confusion in future.. could you just use local pointer for that?

other than that the patchset looks good

thanks,
jirka

>  	}
>  
> -	for (i = 0; i < sib_thr_nr; i++) {
> -		if (str_to_bitmap(sib_thr, &t.sib_thr[i])) {
> +	for (i = 0; i < env->nr_sibling_threads; i++) {
> +		if (str_to_bitmap(env->sibling_threads, &t.sib_thr[i])) {
>  			fprintf(stderr, "topology: can't parse siblings map\n");
>  			goto exit;
>  		}
>  
> -		sib_thr += strlen(sib_thr) + 1;
> +		env->sibling_threads += strlen(env->sibling_threads) + 1;
>  	}
>  

SNIP

      reply	other threads:[~2019-08-16  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 20:38 Kyle Meyer
2019-08-16  9:05 ` Jiri Olsa [this message]

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=20190816090514.GB20709@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=kyle.meyer@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=meyerk@hpe.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=russ.anderson@hpe.com \
    /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

all inboxes | Powered by JetHome®