From patchwork Mon Sep 26 02:22:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Tao X-Patchwork-Id: 12988182 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA775C04A95 for ; Mon, 26 Sep 2022 02:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbiIZCYs (ORCPT ); Sun, 25 Sep 2022 22:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233214AbiIZCYl (ORCPT ); Sun, 25 Sep 2022 22:24:41 -0400 Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E4FA1A7; Sun, 25 Sep 2022 19:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1664159074; bh=cPukUtOLiqyi5AwR+ie+7DqHn1YGnUzhf4l9dRKS2kE=; h=From:To:Cc:Subject:Date; b=yU1Fmtl9cy8zxZw0AQM9yCQexww+xzULjUUfn+pOMPZixDJvywhjhMxE//sxBgn/A +iukxXS9D9XHZDZyoKbsq1pMo48KJ4kPbBSePzgAoveHlhCXGoEG+OzG7lueCFw+tB hXSLHQpheLBMjUjm2rkYMxSeUzVqYMNjJ4udCLAs= Received: from localhost.localdomain ([39.156.73.13]) by newxmesmtplogicsvrsza30.qq.com (NewEsmtp) with SMTP id 5CEB689C; Mon, 26 Sep 2022 10:23:14 +0800 X-QQ-mid: xmsmtpt1664158994ta1rnlxni Message-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7EJt5q From: Rong Tao Cc: Rong Tao , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , 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 X-OQ-MSGID: <20220926022242.20222-1-rtoax@foxmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net From: Rong Tao 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 --- 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");