All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ian Rogers <irogers@google.com>,
	linux-perf-users@vger.kernel.org, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Davidlohr Bueso <dave@stgolabs.net>
Subject: [PATCH 3/7] perf lock: Skip print_bad_events() if nothing bad
Date: Wed,  8 Jun 2022 22:56:48 -0700	[thread overview]
Message-ID: <20220609055652.938821-4-namhyung@kernel.org> (raw)
In-Reply-To: <20220609055652.938821-1-namhyung@kernel.org>

The debug output is meaningful when there are bad lock sequences.
Skip it unless there's one or -v option is given.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-lock.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 118a036a81fb..2337b09dd2cd 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -858,9 +858,16 @@ static void print_bad_events(int bad, int total)
 {
 	/* Output for debug, this have to be removed */
 	int i;
+	int broken = 0;
 	const char *name[4] =
 		{ "acquire", "acquired", "contended", "release" };
 
+	for (i = 0; i < BROKEN_MAX; i++)
+		broken += bad_hist[i];
+
+	if (broken == 0 && !verbose)
+		return;
+
 	pr_info("\n=== output for debug===\n\n");
 	pr_info("bad: %d, total: %d\n", bad, total);
 	pr_info("bad rate: %.2f %%\n", (double)bad / (double)total * 100);
-- 
2.36.1.255.ge46751e96f-goog


  parent reply	other threads:[~2022-06-09  5:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  5:56 [PATCHSET 0/7] perf lock: New lock contention tracepoints support (v3) Namhyung Kim
2022-06-09  5:56 ` [PATCH 1/7] perf lock: Print wait times with unit Namhyung Kim
2022-06-09  5:56 ` [PATCH 2/7] perf lock: Allow to use different kernel symbols Namhyung Kim
2022-06-09  5:56 ` Namhyung Kim [this message]
2022-06-09  5:56 ` [PATCH 4/7] perf lock: Add lock contention tracepoints record support Namhyung Kim
2022-06-09  5:56 ` [PATCH 5/7] perf lock: Handle lock contention tracepoints Namhyung Kim
2022-06-09  5:56 ` [PATCH 6/7] perf record: Allow to specify max stack depth of fp callchain Namhyung Kim
2022-06-09  5:56 ` [PATCH 7/7] perf lock: Look up callchain for the contended locks Namhyung Kim
2022-06-15 16:32 [PATCHSET 0/7] perf lock: New lock contention tracepoints support (v4) Namhyung Kim
2022-06-15 16:32 ` [PATCH 3/7] perf lock: Skip print_bad_events() if nothing bad Namhyung Kim

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=20220609055652.938821-4-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.