[v3] perf stat: Add missing newline in pr_err messages

Message ID 20230614021505.59856-1-yangjihong1@huawei.com
State New
Headers
Series [v3] perf stat: Add missing newline in pr_err messages |

Commit Message

Yang Jihong June 14, 2023, 2:15 a.m. UTC
  The newline is missing for error messages in add_default_attributes()

Before:

  # perf stat --topdown
  Topdown requested but the topdown metric groups aren't present.
  (See perf list the metric groups have names like TopdownL1)#

After:

  # perf stat --topdown
  Topdown requested but the topdown metric groups aren't present.
  (See perf list the metric groups have names like TopdownL1)
  #

In addition, perf_stat_init_aggr_mode() and perf_stat_init_aggr_mode_file()
have the same problem, fixed by the way.

Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@arm.com>
---

Changes since v2:
 - Add Acked-by Ian Rogers
 - Add Reviewed-by James Clark
 - Format patch based on the perf-tools-next

Changes since v1:
 - Correct commit title to `pr_err`

 tools/perf/builtin-stat.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Namhyung Kim June 21, 2023, 5:22 p.m. UTC | #1
On Tue, Jun 13, 2023 at 7:16 PM Yang Jihong <yangjihong1@huawei.com> wrote:
>
> The newline is missing for error messages in add_default_attributes()
>
> Before:
>
>   # perf stat --topdown
>   Topdown requested but the topdown metric groups aren't present.
>   (See perf list the metric groups have names like TopdownL1)#
>
> After:
>
>   # perf stat --topdown
>   Topdown requested but the topdown metric groups aren't present.
>   (See perf list the metric groups have names like TopdownL1)
>   #
>
> In addition, perf_stat_init_aggr_mode() and perf_stat_init_aggr_mode_file()
> have the same problem, fixed by the way.
>
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> Acked-by: Ian Rogers <irogers@google.com>
> Reviewed-by: James Clark <james.clark@arm.com>

Applied to perf-tools-next, thanks!
  

Patch

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index fc615bdeed4f..692de772f8ae 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1594,7 +1594,7 @@  static int perf_stat_init_aggr_mode(void)
 		stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.user_requested_cpus,
 							 get_id, /*data=*/NULL, needs_sort);
 		if (!stat_config.aggr_map) {
-			pr_err("cannot build %s map", aggr_mode__string[stat_config.aggr_mode]);
+			pr_err("cannot build %s map\n", aggr_mode__string[stat_config.aggr_mode]);
 			return -1;
 		}
 		stat_config.aggr_get_id = aggr_mode__get_id(stat_config.aggr_mode);
@@ -1910,7 +1910,7 @@  static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
 	stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.user_requested_cpus,
 						 get_id, env, needs_sort);
 	if (!stat_config.aggr_map) {
-		pr_err("cannot build %s map", aggr_mode__string[stat_config.aggr_mode]);
+		pr_err("cannot build %s map\n", aggr_mode__string[stat_config.aggr_mode]);
 		return -1;
 	}
 	stat_config.aggr_get_id = aggr_mode__get_id_file(stat_config.aggr_mode);
@@ -2050,7 +2050,7 @@  static int add_default_attributes(void)
 		 * on an architecture test for such a metric name.
 		 */
 		if (!metricgroup__has_metric(pmu, "transaction")) {
-			pr_err("Missing transaction metrics");
+			pr_err("Missing transaction metrics\n");
 			return -1;
 		}
 		return metricgroup__parse_groups(evsel_list, pmu, "transaction",
@@ -2066,7 +2066,7 @@  static int add_default_attributes(void)
 		int smi;
 
 		if (sysfs__read_int(FREEZE_ON_SMI_PATH, &smi) < 0) {
-			pr_err("freeze_on_smi is not supported.");
+			pr_err("freeze_on_smi is not supported.\n");
 			return -1;
 		}
 
@@ -2079,7 +2079,7 @@  static int add_default_attributes(void)
 		}
 
 		if (!metricgroup__has_metric(pmu, "smi")) {
-			pr_err("Missing smi metrics");
+			pr_err("Missing smi metrics\n");
 			return -1;
 		}
 
@@ -2104,7 +2104,7 @@  static int add_default_attributes(void)
 
 		if (!max_level) {
 			pr_err("Topdown requested but the topdown metric groups aren't present.\n"
-				"(See perf list the metric groups have names like TopdownL1)");
+				"(See perf list the metric groups have names like TopdownL1)\n");
 			return -1;
 		}
 		if (stat_config.topdown_level > max_level) {