[RFC PATCH v5 12/16] perf stat: Handle NMI in hardware-grouping

weilin.wang@intel.com posted 16 patches 1 year, 8 months ago
[RFC PATCH v5 12/16] perf stat: Handle NMI in hardware-grouping
Posted by weilin.wang@intel.com 1 year, 8 months ago
From: Weilin Wang <weilin.wang@intel.com>

Add an easy nmi watchdog support in grouping. When nmi watchdog is enabled,
we reduce the total num of events could be assigned to one group by 1. A
more efficient solution will be added in later.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Weilin Wang <weilin.wang@intel.com>
---
 tools/perf/util/metricgroup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 9548654c9f6d..31036035484c 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -1993,6 +1993,10 @@ static int insert_new_group(struct list_head *head,
 			   size_t counters_num_fixed)
 {
 	INIT_LIST_HEAD(&new_group->event_head);
+	if (sysctl__nmi_watchdog_enabled()) {
+		pr_debug("NMI watchdog is enabled. Reduce num of counters by 1\n");
+		counters_num_gp -= 1;
+	}
 	fill_counter_bitmap(new_group->gp_counters, 0, counters_num_gp);
 	fill_counter_bitmap(new_group->fixed_counters, 0, counters_num_fixed);
 	list_add_tail(&new_group->nd, head);
-- 
2.42.0