All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 18/24] perf stat: Output running time and run/enabled ratio in CSV mode
Date: Fri, 13 Mar 2015 08:34:41 +0100	[thread overview]
Message-ID: <20150313073441.GA20081@gmail.com> (raw)
In-Reply-To: <1426195684-20046-19-git-send-email-acme@kernel.org>


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> The information how much a counter ran in 'perf stat' can be quite
> interesting for other tools to judge how trustworthy a measurement is.
> 
> Currently it is only output in non CSV mode.
> 
> This patches make perf stat always output the running time and the
> enabled/running ratio in CSV mode.
> 
> This adds two new fields at the end for each line. I assume that
> existing tools ignore new fields at the end, so it's on by default.
> 
> Only CSV mode is affected, no difference otherwise.
> 
> v2: Add extra print_running function
> v3: Avoid printing nan
> v4: Remove some elses and add brackets.
> v5: Move non CSV case into print_running
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> Reviewed-by: Jiri Olsa <jolsa@redhat.com>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Link: http://lkml.kernel.org/r/1426083387-17006-1-git-send-email-andi@firstfloor.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/builtin-stat.c | 47 ++++++++++++++++++++++++-----------------------
>  1 file changed, 24 insertions(+), 23 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index d28949d210cc..765e2204f6bf 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -769,6 +769,18 @@ static int run_perf_stat(int argc, const char **argv)
>  	return ret;
>  }
>  
> +static void print_running(u64 run, u64 ena)
> +{
> +	if (csv_output) {
> +		fprintf(output, "%s%" PRIu64 "%s%.2f",
> +					csv_sep,
> +					run,
> +					csv_sep,
> +					ena ? 100.0 * run / ena : 100.0);
> +	} else if (run != ena)
> +		fprintf(output, "  (%.2f%%)", 100.0 * run / ena);

That's not the standard pattern for 'else if' branches, but:

	} else {
		if ()
			...
	}

to make it stand apart more from a simple 'else' branch.

Thanks,

	Ingo

  reply	other threads:[~2015-03-13  7:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 21:27 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 01/24] perf ordered_events: Untangle from perf_session Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 02/24] perf ordered_events: Shorten function signatures Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 03/24] perf ordered_events: Allow tools to specify a deliver method Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 04/24] perf tools: tool->finished_round() doesn't need perf_session Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 05/24] perf tools: Remove superfluous thread->comm_set setting Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 06/24] perf ordered_events: Adopt queue() method Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 07/24] perf probe: Fix to handle aliased symbols in glibc Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 08/24] perf probe: Fix --line " Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 09/24] Revert "perf probe: Fix to fall back to find probe point in symbols" Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 10/24] perf symbols: Allow symbol alias when loading map for symbol name Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 11/24] perf probe: Allow weak symbols to be probed Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 12/24] perf build: Fix libbabeltrace detection Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 13/24] perf tools: Output feature detection's gcc output to a file Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 14/24] perf probe: Fix possible double free on error Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 15/24] perf hists browser: Fix UI bug after zoom into thread/dso/symbol Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 16/24] perf probe: Fix compiles due to declarations using perf_probe_point Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 17/24] perf hists browser: Fix UI bug after fold/unfold Arnaldo Carvalho de Melo
2015-03-12 21:27 ` [PATCH 18/24] perf stat: Output running time and run/enabled ratio in CSV mode Arnaldo Carvalho de Melo
2015-03-13  7:34   ` Ingo Molnar [this message]
2015-03-13 10:53     ` Arnaldo Carvalho de Melo
2015-03-13 12:31       ` Ingo Molnar
2015-03-12 21:27 ` [PATCH 19/24] perf stat: Fix IPC and other formulas with -A Arnaldo Carvalho de Melo
2015-03-12 21:28 ` [PATCH 20/24] perf stat: Always correctly indent ratio column Arnaldo Carvalho de Melo
2015-03-13  7:36   ` Ingo Molnar
2015-03-12 21:28 ` [PATCH 21/24] perf kmem: Fix segfault when invalid sort key is given Arnaldo Carvalho de Melo
2015-03-12 21:28 ` [PATCH 22/24] perf kmem: Allow -v option Arnaldo Carvalho de Melo
2015-03-12 21:28 ` [PATCH 23/24] perf kmem: Fix alignment of slab result table Arnaldo Carvalho de Melo
2015-03-12 21:28 ` [PATCH 24/24] perf data: Add tracepoint events fields CTF conversion support Arnaldo Carvalho de Melo
2015-03-13 12:34 ` [GIT PULL 00/24] perf/core improvements and fixes Ingo Molnar
2015-03-13 12:45   ` Jiri Olsa

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=20150313073441.GA20081@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@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 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.