summaryrefslogtreecommitdiff
path: root/tools/perf/util/svghelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/svghelper.c')
-rw-r--r--tools/perf/util/svghelper.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index bbdd87163285..2e9971590590 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -19,6 +19,7 @@
#include <linux/zalloc.h>
#include <perf/cpumap.h>
+#include "env.h"
#include "perf.h"
#include "svghelper.h"
#include "cpumap.h"
@@ -752,23 +753,26 @@ 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;
+ char *sib_core, *sib_thr;
- 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));
+
+ sib_core = env->sibling_cores;
+ sib_thr = env->sibling_threads;
if (!t.sib_core || !t.sib_thr) {
fprintf(stderr, "topology: no memory\n");
goto exit;
}
- for (i = 0; i < sib_core_nr; i++) {
+ for (i = 0; i < env->nr_sibling_cores; i++) {
if (str_to_bitmap(sib_core, &t.sib_core[i])) {
fprintf(stderr, "topology: can't parse siblings map\n");
goto exit;
@@ -777,7 +781,7 @@ int svg_build_topology_map(char *sib_core, int sib_core_nr,
sib_core += strlen(sib_core) + 1;
}
- for (i = 0; i < sib_thr_nr; i++) {
+ for (i = 0; i < env->nr_sibling_threads; i++) {
if (str_to_bitmap(sib_thr, &t.sib_thr[i])) {
fprintf(stderr, "topology: can't parse siblings map\n");
goto exit;