linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, mingo@kernel.org, jolsa@kernel.org,
	andi@firstfloor.org, alexander.shishkin@linux.intel.com,
	linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
	namhyung@kernel.org, hpa@zytor.com, mark.rutland@arm.com,
	acme@redhat.com, dsahern@gmail.com
Subject: [tip:perf/core] perf values: Fix thread index bug
Date: Tue, 29 Aug 2017 14:21:07 -0700	[thread overview]
Message-ID: <tip-64eed1deb6d87f4c0efe03297f50367a3689eb56@git.kernel.org> (raw)
In-Reply-To: <20170824162737.7813-7-jolsa@kernel.org>

Commit-ID:  64eed1deb6d87f4c0efe03297f50367a3689eb56
Gitweb:     http://git.kernel.org/tip/64eed1deb6d87f4c0efe03297f50367a3689eb56
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Thu, 24 Aug 2017 18:27:33 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:44:42 -0300

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>
---
 tools/perf/util/values.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index 5de2e15..9ac36bf 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;
 }

  reply	other threads:[~2017-08-29 21:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 16:27 [PATCH 00/10] perf: inherit_stat related fixes Jiri Olsa
2017-08-24 16:27 ` [PATCH 01/10] perf/x86: Add warning on proper cpu during event's update Jiri Olsa
2017-08-28 19:24   ` Peter Zijlstra
2017-08-24 16:27 ` [PATCH 02/10] perf: Fix leader for removed sibling event in perf_group_detach Jiri Olsa
2017-08-28 19:23   ` Peter Zijlstra
2017-08-24 16:27 ` [PATCH 03/10] perf: Make sure we read only scheduled events Jiri Olsa
2017-08-28 19:23   ` Peter Zijlstra
2017-09-01  7:21     ` Jiri Olsa
2017-08-24 16:27 ` [PATCH 04/10] perf record: Set read_format for inherit_stat Jiri Olsa
2017-08-29 21:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 05/10] perf report: Add dump_read function Jiri Olsa
2017-08-29 21:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 06/10] perf values: Fix thread index bug Jiri Olsa
2017-08-29 21:21   ` tip-bot for Jiri Olsa [this message]
2017-08-24 16:27 ` [PATCH 07/10] perf values: Fix allocation check Jiri Olsa
2017-08-29 21:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 08/10] perf values: Zero value buffers Jiri Olsa
2017-08-29 21:21   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 09/10] perf report: Group stat values on global event id Jiri Olsa
2017-08-29 21:22   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-08-24 16:27 ` [PATCH 10/10] perf stat: Support inherit/no-inherit terms Jiri Olsa
2017-08-24 16:30   ` Andi Kleen
2017-08-24 16:45     ` Jiri Olsa
2017-08-25 18:57       ` Arnaldo Carvalho de Melo

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=tip-64eed1deb6d87f4c0efe03297f50367a3689eb56@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).