[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220730030335.78203-8-yangjihong1@huawei.com>
Date: Sat, 30 Jul 2022 11:03:35 +0800
From: Yang Jihong <yangjihong1@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...nel.org>, <namhyung@...nel.org>,
<colin.i.king@...il.com>, <linux-kernel@...r.kernel.org>,
<linux-perf-users@...r.kernel.org>
CC: <pc@...ibm.com>, <yhs@...com>, <andrii.nakryiko@...il.com>,
<songliubraving@...com>, <yangjihong1@...wei.com>
Subject: [PATCH v2 7/7] perf kwork: Add some {} for multiline for/if blocks
Suggested-by: Arnaldo Carvalho de Melo <acme@...nel.org>
Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
---
tools/perf/builtin-kwork.c | 47 ++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index 33bcab2aafcd..f33666ca3ee6 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -177,9 +177,10 @@ static void setup_sorting(struct perf_kwork *kwork,
for (tok = strtok_r(str, ", ", &tmp);
tok; tok = strtok_r(NULL, ", ", &tmp)) {
- if (sort_dimension__add(kwork, tok, &kwork->sort_list) < 0)
+ if (sort_dimension__add(kwork, tok, &kwork->sort_list) < 0) {
usage_with_options_msg(usage_msg, options,
"Unknown --sort key: `%s'", tok);
+ }
}
pr_debug("Sort order: %s\n", kwork->sort_order);
@@ -656,8 +657,9 @@ static void timehist_print_event(struct perf_kwork *kwork,
work->class->work_name(work, kwork_name,
PRINT_KWORK_NAME_WIDTH);
printf(" %-*s ", PRINT_KWORK_NAME_WIDTH, kwork_name);
- } else
+ } else {
printf(" %-*s ", PRINT_KWORK_NAME_WIDTH, "");
+ }
/*
*runtime
@@ -669,11 +671,12 @@ static void timehist_print_event(struct perf_kwork *kwork,
/*
* delaytime
*/
- if (atom->prev != NULL)
+ if (atom->prev != NULL) {
printf(" %*.*f ", PRINT_LATENCY_WIDTH, RPINT_DECIMAL_WIDTH,
(double)(atom->time - atom->prev->time) / NSEC_PER_MSEC);
- else
+ } else {
printf(" %*s ", PRINT_LATENCY_WIDTH, " ");
+ }
/*
* callchain
@@ -761,9 +764,10 @@ static int process_irq_handler_entry_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->entry_event)
+ if (kwork->tp_handler->entry_event) {
return kwork->tp_handler->entry_event(kwork, &kwork_irq,
evsel, sample, machine);
+ }
return 0;
}
@@ -774,9 +778,10 @@ static int process_irq_handler_exit_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->exit_event)
+ if (kwork->tp_handler->exit_event) {
return kwork->tp_handler->exit_event(kwork, &kwork_irq,
evsel, sample, machine);
+ }
return 0;
}
@@ -832,10 +837,10 @@ static int process_softirq_raise_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->raise_event)
+ if (kwork->tp_handler->raise_event) {
return kwork->tp_handler->raise_event(kwork, &kwork_softirq,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -846,10 +851,10 @@ static int process_softirq_entry_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->entry_event)
+ if (kwork->tp_handler->entry_event) {
return kwork->tp_handler->entry_event(kwork, &kwork_softirq,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -860,10 +865,10 @@ static int process_softirq_exit_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->exit_event)
+ if (kwork->tp_handler->exit_event) {
return kwork->tp_handler->exit_event(kwork, &kwork_softirq,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -953,10 +958,10 @@ static int process_workqueue_activate_work_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->raise_event)
+ if (kwork->tp_handler->raise_event) {
return kwork->tp_handler->raise_event(kwork, &kwork_workqueue,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -967,10 +972,10 @@ static int process_workqueue_execute_start_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->entry_event)
+ if (kwork->tp_handler->entry_event) {
return kwork->tp_handler->entry_event(kwork, &kwork_workqueue,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -981,10 +986,10 @@ static int process_workqueue_execute_end_event(struct perf_tool *tool,
{
struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool);
- if (kwork->tp_handler->exit_event)
+ if (kwork->tp_handler->exit_event) {
return kwork->tp_handler->exit_event(kwork, &kwork_workqueue,
evsel, sample, machine);
-
+ }
return 0;
}
@@ -1253,9 +1258,10 @@ static void print_skipped_events(struct perf_kwork *kwork)
}
}
- if (verbose > 0)
+ if (verbose > 0) {
printf(" INFO: use %lld atom pages\n",
nr_list_entry(&kwork->atom_page_list));
+ }
}
static void print_bad_events(struct perf_kwork *kwork)
@@ -1332,10 +1338,11 @@ static int perf_kwork__check_config(struct perf_kwork *kwork,
return -1;
}
- list_for_each_entry(class, &kwork->class_list, list)
+ list_for_each_entry(class, &kwork->class_list, list) {
if ((class->class_init != NULL) &&
(class->class_init(class, session) != 0))
return -1;
+ }
if (kwork->cpu_list != NULL) {
ret = perf_session__cpu_bitmap(session,
--
2.30.GIT
Powered by blists - more mailing lists