Re: [RFC v3 01/17] perf kwork: New tool
From: Arnaldo Carvalho de Melo
Date: Tue Jul 26 2022 - 13:28:09 EST
Em Sat, Jul 09, 2022 at 09:50:17AM +0800, Yang Jihong escreveu:
> The perf-kwork tool is used to trace time properties of kernel work
> (such as irq, softirq, and workqueue), including runtime, latency,
> and timehist, using the infrastructure in the perf tools to allow
> tracing extra targets.
>
> This is the first commit to reuse perf_record framework code to
> implement a simple record function, kwork is not supported currently.
So, since I have to fix some issues I'm adding small stylistic changes,
starting with this:
- multiline if/for blocks need {}
- remove needless spaces between variable declaration + initialization.
- Arnaldo
diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index f3552c56ede3c501..bfa5c53f1273c631 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -49,9 +49,10 @@ static void setup_event_list(struct perf_kwork *kwork,
break;
}
}
- if (i == KWORK_CLASS_MAX)
+ if (i == KWORK_CLASS_MAX) {
usage_with_options_msg(usage_msg, options,
"Unknown --event key: `%s'", tok);
+ }
}
free(str);
@@ -59,10 +60,12 @@ static void setup_event_list(struct perf_kwork *kwork,
/*
* config all kwork events if not specified
*/
- if (list_empty(&kwork->class_list))
- for (i = 0; i < KWORK_CLASS_MAX; i++)
+ if (list_empty(&kwork->class_list)) {
+ for (i = 0; i < KWORK_CLASS_MAX; i++) {
list_add_tail(&kwork_class_supported_list[i]->list,
&kwork->class_list);
+ }
+ }
pr_debug("Config event list:");
list_for_each_entry(class, &kwork->class_list, list)
@@ -125,7 +128,6 @@ int cmd_kwork(int argc, const char **argv)
.force = false,
.event_list_str = NULL,
};
-
const struct option kwork_options[] = {
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"),