}
if (run == 0 || ena == 0 || counter->counts->scaled == -1) {
- if (config->metric_only) {
- pm(config, os, METRIC_THRESHOLD_UNKNOWN, /*format=*/NULL,
- /*unit=*/NULL, /*val=*/0);
- return;
- }
-
ok = false;
if (counter->supported) {
print_running(config, os, run, ena, /*before_metric=*/true);
}
- if (ok) {
- if (!config->metric_only && counter->default_metricgroup && !counter->default_show_events) {
- void *from = NULL;
-
- aggr_printout(config, os, os->evsel, os->id, os->aggr_nr);
- /* Print out all the metricgroup with the same metric event. */
- do {
- int num = 0;
-
- /* Print out the new line for the next new metricgroup. */
- if (from) {
- if (config->json_output)
- new_line_json(config, (void *)os);
- else
- __new_line_std_csv(config, os);
- }
-
- print_noise(config, os, counter, noise, /*before_metric=*/true);
- print_running(config, os, run, ena, /*before_metric=*/true);
- from = perf_stat__print_shadow_stats_metricgroup(config, counter, aggr_idx,
- &num, from, &out);
- } while (from != NULL);
- } else {
- perf_stat__print_shadow_stats(config, counter, aggr_idx, &out);
- }
+ if (!config->metric_only && counter->default_metricgroup &&
+ !counter->default_show_events) {
+ void *from = NULL;
+
+ aggr_printout(config, os, os->evsel, os->id, os->aggr_nr);
+ /* Print out all the metricgroup with the same metric event. */
+ do {
+ int num = 0;
+
+ /* Print out the new line for the next new metricgroup. */
+ if (from) {
+ if (config->json_output)
+ new_line_json(config, (void *)os);
+ else
+ __new_line_std_csv(config, os);
+ }
+
+ print_noise(config, os, counter, noise,
+ /*before_metric=*/true);
+ print_running(config, os, run, ena,
+ /*before_metric=*/true);
+ from = perf_stat__print_shadow_stats_metricgroup(
+ config, counter, aggr_idx, &num, from, &out);
+ } while (from != NULL);
} else {
- pm(config, os, METRIC_THRESHOLD_UNKNOWN, /*format=*/NULL, /*unit=*/NULL, /*val=*/0);
+ perf_stat__print_shadow_stats(config, counter, aggr_idx, &out);
}
if (!config->metric_only) {
ena = aggr->counts.ena;
run = aggr->counts.run;
- if (perf_stat__skip_metric_event(counter, ena, run))
+ if (perf_stat__skip_metric_event(counter))
return;
if (val == 0 && should_skip_zero_counter(config, counter, &id))
}
/* Time events are always on CPU0, the first aggregation index. */
aggr = &ps->aggr[is_tool_time ? tool_aggr_idx : aggr_idx];
- if (!aggr || !metric_events[i]->supported) {
+ if (!aggr || !metric_events[i]->supported || aggr->counts.run == 0) {
/*
* Not supported events will have a count of 0, which
* can be confusing in a metric. Explicitly set the
* perf_stat__skip_metric_event - Skip the evsel in the Default metricgroup,
* if it's not running or not the metric event.
*/
-bool perf_stat__skip_metric_event(struct evsel *evsel,
- u64 ena, u64 run)
+bool perf_stat__skip_metric_event(struct evsel *evsel)
{
if (!evsel->default_metricgroup)
return false;
- if (!ena || !run)
- return true;
-
return !metricgroup__lookup(&evsel->evlist->metric_events, evsel, false);
}