Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ivan Lazaric <ivan.lazaric1@gmail.com>
Cc: linux-perf-users@vger.kernel.org, irogers@google.com
Subject: Re: [PATCH] perf stat: reject --field-separator and --json-output combination
Date: Tue, 7 Jul 2026 23:21:36 -0700	[thread overview]
Message-ID: <ak3scJT4MfbAg0G4@google.com> (raw)
In-Reply-To: <20260705005840.1252666-1-ivan.lazaric1@gmail.com>

Hello,

On Sun, Jul 05, 2026 at 02:58:40AM +0200, Ivan Lazaric wrote:
> Specifying --field-separator option is stating you want CSV output.
> Passing both --field-separator and --json-output is then stating
> you want output to be in CSV and JSON format at same time.
> 
> Currently this combination is not rejected, and the outcome
> is a malformed combination of CSV and JSON output.
> This is because of inconsistencies in various printing functions,
> some of them have if-else chains that start with
> "Should I print JSON?", and some start with "Should I print CSV?".
> 
> Example of current output:
> $ tools/perf/perf stat -x , -j -e cpu-migrations true
> {"counter-value" : "0.000000", "unit" : "", "event" : "cpu-migrations", "event-runtime" : 474817, "pcnt-running" : 100.00,,
> 
> Instead reject the option combination,
> with a helpful error message and non-zero exit code.
> 
> Example of new output:
> $ tools/perf/perf stat -x , -j true
> cannot use both --field-separator and --json-output
> 
>  Usage: perf stat [<options>] [<command>]
> 
>     -x, --field-separator <separator>
>                           print counts with custom separator
>     -j, --json-output     print counts in JSON format
> 
> Signed-off-by: Ivan Lazaric <ivan.lazaric1@gmail.com>

Thanks for the patch, but it doesn't apply cleanly.  Can you please
rebase it on to the latest perf-tools-next branch?

Thanks,
Namhyung

  reply	other threads:[~2026-07-08  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05  0:58 [PATCH] perf stat: reject --field-separator and --json-output combination Ivan Lazaric
2026-07-08  6:21 ` Namhyung Kim [this message]
2026-07-08 13:14   ` [PATCH v2] " Ivan Lazaric
2026-07-08 13:36     ` sashiko-bot
2026-07-08 23:43       ` Namhyung Kim
2026-07-10  0:41     ` Namhyung Kim

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=ak3scJT4MfbAg0G4@google.com \
    --to=namhyung@kernel.org \
    --cc=irogers@google.com \
    --cc=ivan.lazaric1@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    /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