aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Olsa <[email protected]>2017-08-24 18:27:33 +0200
committerArnaldo Carvalho de Melo <[email protected]>2017-08-28 16:44:42 -0300
commit64eed1deb6d87f4c0efe03297f50367a3689eb56 (patch)
tree9434c6853643e544d2bab2909c2ab36da74ccdbd
parentdac7f6b7ed1c8601358357f60e9764a4c6a68d71 (diff)
perf values: Fix thread index bug
We are taking wrong index (+1) for first thread, which leaves thread with index 0 unused and uninitialized. Signed-off-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Ahern <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/values.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index 5de2e15e2eda..9ac36bf2c438 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -98,7 +98,7 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values,
return i;
}
- i = values->threads + 1;
+ i = values->threads;
values->value[i] = malloc(values->counters_max * sizeof(**values->value));
if (!values->value[i]) {
pr_debug("failed to allocate read_values counters array");
@@ -106,7 +106,7 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values,
}
values->pid[i] = pid;
values->tid[i] = tid;
- values->threads = i;
+ values->threads = i + 1;
return i;
}