mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rong Tao <rtoax@foxmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Rong Tao <rongtao@cestc.cn>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next] samples/bpf: offwaketime: pretty print
Date: Mon, 26 Sep 2022 10:22:42 +0800	[thread overview]
Message-ID: <tencent_1C233A1BC00A0164C55FCAAB24BF768C320A@qq.com> (raw)

From: Rong Tao <rongtao@cestc.cn>

A sample of call stack:
swapper/10 [
	secondary_startup_64_no_verify
	cpu_startup_entry
	do_idle
	schedule_idle
	__schedule
	__traceiter_sched_switch
	__traceiter_sched_switch
	-
	try_to_wake_up
	call_timer_fn
	__run_timers.part.0
	run_timer_softirq
	__softirqentry_text_start
	__irq_exit_rcu
	sysvec_apic_timer_interrupt
	asm_sysvec_apic_timer_interrupt
	cpuidle_enter_state
	cpuidle_enter
	cpuidle_idle_call
	do_idle
	cpu_startup_entry
	secondary_startup_64_no_verify
] swapper/10 1

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 samples/bpf/offwaketime_user.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c
index b6eedcb98fb9..d89278d62e4e 100644
--- a/samples/bpf/offwaketime_user.c
+++ b/samples/bpf/offwaketime_user.c
@@ -30,9 +30,9 @@ static void print_ksym(__u64 addr)
 	}
 
 	if (PRINT_RAW_ADDR)
-		printf("%s/%llx;", sym->name, addr);
+		printf("\t%s/%llx\n", sym->name, addr);
 	else
-		printf("%s;", sym->name);
+		printf("\t%s\n", sym->name);
 }
 
 #define TASK_COMM_LEN 16
@@ -50,21 +50,21 @@ static void print_stack(struct key_t *key, __u64 count)
 	static bool warned;
 	int i;
 
-	printf("%s;", key->target);
+	printf("%s [\n", key->target);
 	if (bpf_map_lookup_elem(map_fd[1], &key->tret, ip) != 0) {
-		printf("---;");
+		printf("\t---\n");
 	} else {
 		for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
 			print_ksym(ip[i]);
 	}
-	printf("-;");
+	printf("\t-\n");
 	if (bpf_map_lookup_elem(map_fd[1], &key->wret, ip) != 0) {
-		printf("---;");
+		printf("\t---\n");
 	} else {
 		for (i = 0; i < PERF_MAX_STACK_DEPTH; i++)
 			print_ksym(ip[i]);
 	}
-	printf(";%s %lld\n", key->waker, count);
+	printf("] %s %lld\n", key->waker, count);
 
 	if ((key->tret == -EEXIST || key->wret == -EEXIST) && !warned) {
 		printf("stackmap collisions seen. Consider increasing size\n");
-- 
2.31.1


             reply	other threads:[~2022-09-26  2:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  2:22 Rong Tao [this message]
2022-09-27 23:37 ` Martin KaFai Lau
2022-09-28  1:20   ` Rong Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_1C233A1BC00A0164C55FCAAB24BF768C320A@qq.com \
    --to=rtoax@foxmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=rongtao@cestc.cn \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®