diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-08-24 12:27:33 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-08-28 15:44:42 -0400 |
commit | 64eed1deb6d87f4c0efe03297f50367a3689eb56 (patch) | |
tree | 9434c6853643e544d2bab2909c2ab36da74ccdbd /tools/perf | |
parent | dac7f6b7ed1c8601358357f60e9764a4c6a68d71 (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 <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170824162737.7813-7-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/values.c | 4 |
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, | |||
98 | return i; | 98 | return i; |
99 | } | 99 | } |
100 | 100 | ||
101 | i = values->threads + 1; | 101 | i = values->threads; |
102 | values->value[i] = malloc(values->counters_max * sizeof(**values->value)); | 102 | values->value[i] = malloc(values->counters_max * sizeof(**values->value)); |
103 | if (!values->value[i]) { | 103 | if (!values->value[i]) { |
104 | pr_debug("failed to allocate read_values counters array"); | 104 | 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, | |||
106 | } | 106 | } |
107 | values->pid[i] = pid; | 107 | values->pid[i] = pid; |
108 | values->tid[i] = tid; | 108 | values->tid[i] = tid; |
109 | values->threads = i; | 109 | values->threads = i + 1; |
110 | 110 | ||
111 | return i; | 111 | return i; |
112 | } | 112 | } |