[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aVhC40oJIx1cbfiJ@google.com>
Date: Fri, 2 Jan 2026 14:12:51 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Swapnil Sapkal <swapnil.sapkal@....com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
irogers@...gle.com, james.clark@....com, ravi.bangoria@....com,
yu.c.chen@...el.com, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
rostedt@...dmis.org, vincent.guittot@...aro.org,
adrian.hunter@...el.com, kan.liang@...ux.intel.com,
gautham.shenoy@....com, kprateek.nayak@....com,
juri.lelli@...hat.com, yangjihong@...edance.com, void@...ifault.com,
tj@...nel.org, sshegde@...ux.ibm.com, ctshao@...gle.com,
quic_zhonhan@...cinc.com, thomas.falcon@...el.com,
blakejones@...gle.com, ashelat@...hat.com, leo.yan@....com,
dvyukov@...gle.com, ak@...ux.intel.com, yujie.liu@...el.com,
graham.woodward@....com, ben.gainey@....com, vineethr@...ux.ibm.com,
tim.c.chen@...ux.intel.com, linux@...blig.org,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
santosh.shukla@....com, sandipan.das@....com
Subject: Re: [PATCH RESEND v4 01/11] perf: Add print_separator to util
Hello,
Sorry for the delay and happy new year!
On Tue, Sep 09, 2025 at 11:42:17AM +0000, Swapnil Sapkal wrote:
> Add print_separator to util.c and use it wherever necessary.
>
> Signed-off-by: Swapnil Sapkal <swapnil.sapkal@....com>
> ---
> tools/perf/builtin-kwork.c | 13 ++++---------
> tools/perf/util/util.c | 6 ++++++
> tools/perf/util/util.h | 2 ++
> 3 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
> index d2e08de5976d..842f59ff85ac 100644
> --- a/tools/perf/builtin-kwork.c
> +++ b/tools/perf/builtin-kwork.c
> @@ -1340,11 +1340,6 @@ static struct kwork_class *kwork_class_supported_list[KWORK_CLASS_MAX] = {
> [KWORK_CLASS_SCHED] = &kwork_sched,
> };
>
> -static void print_separator(int len)
> -{
> - printf(" %.*s\n", len, graph_dotted_line);
> -}
> -
> static int report_print_work(struct perf_kwork *kwork, struct kwork_work *work)
> {
> int ret = 0;
> @@ -1458,7 +1453,7 @@ static int report_print_header(struct perf_kwork *kwork)
> }
>
> printf("\n");
> - print_separator(ret);
> + print_separator(ret, "", 0);
> return ret;
> }
>
> @@ -1633,7 +1628,7 @@ static void top_print_header(struct perf_kwork *kwork __maybe_unused)
> PRINT_RUNTIME_HEADER_WIDTH + RPINT_DECIMAL_WIDTH, "RUNTIME",
> PRINT_TASK_NAME_WIDTH, "COMMAND");
> printf("\n ");
> - print_separator(ret);
> + print_separator(ret, "", 0);
> }
>
> static int top_print_work(struct perf_kwork *kwork __maybe_unused, struct kwork_work *work)
> @@ -1933,11 +1928,11 @@ static int perf_kwork__report(struct perf_kwork *kwork)
> }
> next = rb_next(next);
> }
> - print_separator(ret);
> + print_separator(ret, "", 0);
>
> if (kwork->summary) {
> print_summary(kwork);
> - print_separator(ret);
> + print_separator(ret, "", 0);
> }
>
> print_bad_events(kwork);
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 0f031eb80b4c..1b91834e11de 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -257,6 +257,12 @@ static int rm_rf_kcore_dir(const char *path)
> return 0;
> }
>
> +void print_separator(int pre_dash_cnt, const char *s, int post_dash_cnt)
> +{
> + printf("%.*s%s%.*s\n", pre_dash_cnt, graph_dotted_line, s, post_dash_cnt,
> + graph_dotted_line);
> +}
I think it's better to keep the existing interface and add a new one
like print_separator2() for your case. The old one can be implemented
on top of the new API.
Thanks,
Namhyung
> +
> int rm_rf_perf_data(const char *path)
> {
> const char *pat[] = {
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index 3423778e39a5..de69384380c2 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -48,6 +48,8 @@ bool sysctl__nmi_watchdog_enabled(void);
>
> int perf_tip(char **strp, const char *dirpath);
>
> +void print_separator(int pre_dash_cnt, const char *s, int post_dash_cnt);
> +
> #ifndef HAVE_SCHED_GETCPU_SUPPORT
> int sched_getcpu(void);
> #endif
> --
> 2.43.0
>
Powered by blists - more mailing lists