[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1479894292-16277-14-git-send-email-kan.liang@intel.com>
Date: Wed, 23 Nov 2016 04:44:51 -0500
From: kan.liang@...el.com
To: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
linux-kernel@...r.kernel.org
Cc: alexander.shishkin@...ux.intel.com, tglx@...utronix.de,
namhyung@...nel.org, jolsa@...nel.org, adrian.hunter@...el.com,
wangnan0@...wei.com, mark.rutland@....com, andi@...stfloor.org,
Kan Liang <kan.liang@...el.com>
Subject: [PATCH 13/14] perf tools: warn on high overhead
From: Kan Liang <kan.liang@...el.com>
The rough overhead rate can be caculated by the sum of all kinds of
overhead / elapsed time.
If the overhead rate is higher than 10%, warning the user.
Signed-off-by: Kan Liang <kan.liang@...el.com>
---
tools/perf/util/session.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index e84808f..decfc48 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1559,6 +1559,30 @@ perf_session__warn_order(const struct perf_session *session)
ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
}
+static void
+perf_session__warn_overhead(const struct perf_session *session)
+{
+ const struct events_stats *stats = &session->evlist->stats;
+ double overhead_rate;
+ u64 overhead;
+ int i;
+
+ for (i = 0; i < session->header.env.nr_cpus_online; i++) {
+ overhead = stats->total_nmi_overhead[i][1];
+ overhead += stats->total_mux_overhead[i][1];
+ overhead += stats->total_sb_overhead[i][1];
+ overhead += stats->total_user_write_overhead[i][1];
+
+ overhead_rate = (double)overhead / (double)stats->elapsed_time;
+
+ if (overhead_rate > 0.1) {
+ ui__warning("Perf overhead is high! The overhead rate is %3.2f%% on CPU %d\n\n"
+ "Please consider reducing the number of events, or increasing the period, or decrease the frequency.\n\n",
+ overhead_rate * 100.0, i);
+ }
+ }
+}
+
static void perf_session__warn_about_errors(const struct perf_session *session)
{
const struct events_stats *stats = &session->evlist->stats;
@@ -1632,6 +1656,8 @@ static void perf_session__warn_about_errors(const struct perf_session *session)
"Increase it by --proc-map-timeout\n",
stats->nr_proc_map_timeout);
}
+
+ perf_session__warn_overhead(session);
}
static int perf_session__flush_thread_stack(struct thread *thread,
--
2.5.5
Powered by blists - more mailing lists