Messages in this thread | | | Date | Fri, 16 Aug 2019 11:05:14 +0200 | From | Jiri Olsa <> | Subject | Re: [PATCH v2 1/6] perf: Refactor svg_build_topology_map |
| |
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
| |