All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] perf kwork: A couple of fixes according to review comments
@ 2022-07-28 11:58 Yang Jihong
  2022-07-28 11:58 ` [PATCH 1/5] perf kwork: Add '--synth task' option for record Yang Jihong
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Some issues are fixed based on the comments of several reviewers:
1. Add '--synth task' option for record (note from Namhyung)
2. Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro (note from Namhyung)
3. Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH" (note from Namhyung)
4. Fix spelling mistake: "Captuer" -> "Capture" (note from Colin)
5. Add some {} for multiline for/if blocks (note from Arnaldo)

Modifying based on the latest commit (a061a8ad3f90) at acme/perf/core:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core

Yang Jihong (5):
  perf kwork: Add '--synth task' option for record
  perf kwork: Replace hard-coded initialization of nr_tracepoints with
    ARRAY_SIZE macro
  perf kwork: Fix spelling mistake: "Captuer" -> "Capture"
  perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" ->
    "PRINT_TIME_UNIT_MSEC_WIDTH"
  perf kwork: Add some {} for multiline for/if blocks

 tools/perf/builtin-kwork.c | 65 ++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 27 deletions(-)

-- 
2.30.GIT


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] perf kwork: Add '--synth task' option for record
  2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
@ 2022-07-28 11:58 ` Yang Jihong
  2022-07-28 11:58 ` [PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro Yang Jihong
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Since we don't need user space symbols, add '--synth task' option to skip
costly synthesis.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/builtin-kwork.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index fb8c63656ad8..ff17711a554a 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -1631,6 +1631,10 @@ static int perf_kwork__record(struct perf_kwork *kwork,
 		"-R",
 		"-m", "1024",
 		"-c", "1",
+		/*
+		 * Skip synthesis as we do not need user space symbols.
+		 */
+		"--synth", "task",
 	};
 
 	rec_argc = ARRAY_SIZE(record_args) + argc - 1;
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro
  2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
  2022-07-28 11:58 ` [PATCH 1/5] perf kwork: Add '--synth task' option for record Yang Jihong
@ 2022-07-28 11:58 ` Yang Jihong
  2022-07-28 11:58 ` [PATCH 3/5] perf kwork: Fix spelling mistake: "Captuer" -> "Capture" Yang Jihong
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Use ARRAY_SIZE macro to replace hard-coded initialization of nr_tracepoints
for future changes.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/builtin-kwork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index ff17711a554a..2143280c2e95 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -817,7 +817,7 @@ static void irq_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_irq = {
 	.name           = "irq",
 	.type           = KWORK_CLASS_IRQ,
-	.nr_tracepoints = 2,
+	.nr_tracepoints = ARRAY_SIZE(irq_tp_handlers),
 	.tp_handlers    = irq_tp_handlers,
 	.class_init     = irq_class_init,
 	.work_init      = irq_work_init,
@@ -938,7 +938,7 @@ static void softirq_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_softirq = {
 	.name           = "softirq",
 	.type           = KWORK_CLASS_SOFTIRQ,
-	.nr_tracepoints = 3,
+	.nr_tracepoints = ARRAY_SIZE(softirq_tp_handlers),
 	.tp_handlers    = softirq_tp_handlers,
 	.class_init     = softirq_class_init,
 	.work_init      = softirq_work_init,
@@ -1035,7 +1035,7 @@ static void workqueue_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_workqueue = {
 	.name           = "workqueue",
 	.type           = KWORK_CLASS_WORKQUEUE,
-	.nr_tracepoints = 3,
+	.nr_tracepoints = ARRAY_SIZE(workqueue_tp_handlers),
 	.tp_handlers    = workqueue_tp_handlers,
 	.class_init     = workqueue_class_init,
 	.work_init      = workqueue_work_init,
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] perf kwork: Fix spelling mistake: "Captuer" -> "Capture"
  2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
  2022-07-28 11:58 ` [PATCH 1/5] perf kwork: Add '--synth task' option for record Yang Jihong
  2022-07-28 11:58 ` [PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro Yang Jihong
@ 2022-07-28 11:58 ` Yang Jihong
  2022-07-28 11:58 ` [PATCH 4/5] perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH" Yang Jihong
  2022-07-28 11:58 ` [PATCH 5/5] perf kwork: Add some {} for multiline for/if blocks Yang Jihong
  4 siblings, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/builtin-kwork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index 2143280c2e95..9e8b9f9e0472 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -1447,7 +1447,7 @@ static void sig_handler(int sig)
 	 * Simply capture termination signal so that
 	 * the program can continue after pause returns
 	 */
-	pr_debug("Captuer signal %d\n", sig);
+	pr_debug("Capture signal %d\n", sig);
 }
 
 static int perf_kwork__report_bpf(struct perf_kwork *kwork)
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH"
  2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
                   ` (2 preceding siblings ...)
  2022-07-28 11:58 ` [PATCH 3/5] perf kwork: Fix spelling mistake: "Captuer" -> "Capture" Yang Jihong
@ 2022-07-28 11:58 ` Yang Jihong
  2022-07-28 11:58 ` [PATCH 5/5] perf kwork: Add some {} for multiline for/if blocks Yang Jihong
  4 siblings, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/builtin-kwork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index 9e8b9f9e0472..d6c09044a929 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -37,9 +37,9 @@
 #define RPINT_DECIMAL_WIDTH 3
 #define PRINT_BRACKETPAIR_WIDTH 2
 #define PRINT_TIME_UNIT_SEC_WIDTH 2
-#define PRINT_TIME_UNIT_MESC_WIDTH 3
-#define PRINT_RUNTIME_HEADER_WIDTH (PRINT_RUNTIME_WIDTH + PRINT_TIME_UNIT_MESC_WIDTH)
-#define PRINT_LATENCY_HEADER_WIDTH (PRINT_LATENCY_WIDTH + PRINT_TIME_UNIT_MESC_WIDTH)
+#define PRINT_TIME_UNIT_MSEC_WIDTH 3
+#define PRINT_RUNTIME_HEADER_WIDTH (PRINT_RUNTIME_WIDTH + PRINT_TIME_UNIT_MSEC_WIDTH)
+#define PRINT_LATENCY_HEADER_WIDTH (PRINT_LATENCY_WIDTH + PRINT_TIME_UNIT_MSEC_WIDTH)
 #define PRINT_TIMEHIST_CPU_WIDTH (PRINT_CPU_WIDTH + PRINT_BRACKETPAIR_WIDTH)
 #define PRINT_TIMESTAMP_HEADER_WIDTH (PRINT_TIMESTAMP_WIDTH + PRINT_TIME_UNIT_SEC_WIDTH)
 
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] perf kwork: Add some {} for multiline for/if blocks
  2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
                   ` (3 preceding siblings ...)
  2022-07-28 11:58 ` [PATCH 4/5] perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH" Yang Jihong
@ 2022-07-28 11:58 ` Yang Jihong
  4 siblings, 0 replies; 6+ messages in thread
From: Yang Jihong @ 2022-07-28 11:58 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, colin.i.king, linux-kernel, linux-perf-users
  Cc: pc, yhs, andrii.nakryiko, songliubraving, yangjihong1

Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Yang Jihong <yangjihong1@huawei.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 d6c09044a929..b80f7279c4a8 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-28 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28 11:58 [PATCH 0/5] perf kwork: A couple of fixes according to review comments Yang Jihong
2022-07-28 11:58 ` [PATCH 1/5] perf kwork: Add '--synth task' option for record Yang Jihong
2022-07-28 11:58 ` [PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro Yang Jihong
2022-07-28 11:58 ` [PATCH 3/5] perf kwork: Fix spelling mistake: "Captuer" -> "Capture" Yang Jihong
2022-07-28 11:58 ` [PATCH 4/5] perf kwork: Fix spelling mistake: "PRINT_TIME_UNIT_MESC_WIDTH" -> "PRINT_TIME_UNIT_MSEC_WIDTH" Yang Jihong
2022-07-28 11:58 ` [PATCH 5/5] perf kwork: Add some {} for multiline for/if blocks Yang Jihong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.