public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, David Ahern <daahern@cisco.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 07/10] perf script: Move printing of 'common' data from print_event and rename
Date: Thu, 10 Mar 2011 00:50:11 +0100	[thread overview]
Message-ID: <20110309235007.GB2533@nowhere> (raw)
In-Reply-To: <1299695491-15786-8-git-send-email-acme@infradead.org>

On Wed, Mar 09, 2011 at 03:31:28PM -0300, Arnaldo Carvalho de Melo wrote:
> From: David Ahern <daahern@cisco.com>
> 
> This change does impact output: latency data is trace specific and is now
> printed after the common data - comm, tid, cpu, time and event name.
> 
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> LPU-Reference: <1299606342-26745-3-git-send-email-daahern@cisco.com>
> Signed-off-by: David Ahern <daahern@cisco.com>
> [ committer note: Added space after print_lat_fmt() ]
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/builtin-script.c         |   38 ++++++++++--
>  tools/perf/util/trace-event-parse.c |  106 +++--------------------------------
>  tools/perf/util/trace-event.h       |    3 +-
>  3 files changed, 41 insertions(+), 106 deletions(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index b2bdd55..0a79da2 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -20,18 +20,42 @@ static u64			last_timestamp;
>  static u64			nr_unordered;
>  extern const struct option	record_options[];
>  
> +static void print_sample_start(struct perf_sample *sample,
> +			       struct thread *thread)
> +{
> +	int type;
> +	struct event *event;
> +	const char *evname = NULL;
> +	unsigned long secs;
> +	unsigned long usecs;
> +	unsigned long long nsecs = sample->time;
> +
> +	if (latency_format)

I believe we don't yet make use of the latency format with perf.
Like the function graph output, it was included in that code coming
from trace-cmd.

We might use it in the future though, so it looks fine to keep it
and handle it like you did.

> +		printf("%8.8s-%-5d %3d", thread->comm, sample->tid, sample->cpu);
> +	else
> +		printf("%16s-%-5d [%03d]", thread->comm, sample->tid, sample->cpu);
> +
> +	secs = nsecs / NSECS_PER_SEC;
> +	nsecs -= secs * NSECS_PER_SEC;
> +	usecs = nsecs / NSECS_PER_USEC;
> +	printf(" %5lu.%06lu: ", secs, usecs);
> +
> +	type = trace_parse_common_type(sample->raw_data);
> +	event = trace_find_event(type);
> +	if (event)
> +		evname = event->name;
> +
> +	printf("%s: ", evname ? evname : "(unknown)");
> +}
> +
[...]
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -2648,63 +2648,8 @@ static void print_lat_fmt(void *data, int size __unused)
>  		printf("%d", lock_depth);
>  }
>  
> -/* taken from Linux, written by Frederic Weisbecker */
> -static void print_graph_cpu(int cpu)
> -{
> -	int i;
> -	int log10_this = log10_cpu(cpu);
> -	int log10_all = log10_cpu(cpus);
> -
> -
> -	/*
> -	 * Start with a space character - to make it stand out
> -	 * to the right a bit when trace output is pasted into
> -	 * email:
> -	 */
> -	printf(" ");
> -
> -	/*
> -	 * Tricky - we space the CPU field according to the max
> -	 * number of online CPUs. On a 2-cpu system it would take
> -	 * a maximum of 1 digit - on a 128 cpu system it would
> -	 * take up to 3 digits:
> -	 */
> -	for (i = 0; i < log10_all - log10_this; i++)
> -		printf(" ");
> -
> -	printf("%d) ", cpu);
> -}

So, we indeed don't use the function graph tracer with perf yet.
But there are fair chances we will in the future.

So if we remove such code, I would prefer this to be made as
a seperate commit. Something we can easily retrieve and revert
in the future.

Other than that and the callchain bug, the whole series looks
pretty good now.

Thanks a lot!

  reply	other threads:[~2011-03-09 23:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 18:31 [GIT PULL 00/10] perf/core fixes and improvements Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 01/10] perf session: Simplify evlist creation from perf.data header Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 02/10] perf evsel: Assume rest of perf_header_attr functions Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 03/10] perf header: Stop using 'self' Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 04/10] perf top: Fix events overflow in top command Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 05/10] perf top: Don't let events to eat up whole header line Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 06/10] perf script: Change process_event prototype Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 07/10] perf script: Move printing of 'common' data from print_event and rename Arnaldo Carvalho de Melo
2011-03-09 23:50   ` Frederic Weisbecker [this message]
2011-03-10  0:04     ` David Ahern
2011-03-10  0:10       ` Frederic Weisbecker
2011-03-10  0:11         ` David Ahern
2011-03-10  0:14           ` Frederic Weisbecker
2011-03-10  0:22           ` Frederic Weisbecker
2011-03-10  0:32             ` David Ahern
2011-03-10  0:50               ` Frederic Weisbecker
2011-03-09 18:31 ` [PATCH 08/10] perf script: Support custom field selection for output Arnaldo Carvalho de Melo
2011-03-09 18:31 ` [PATCH 09/10] perf script: Add support for dumping symbols Arnaldo Carvalho de Melo
2011-03-09 23:30   ` Frederic Weisbecker
2011-03-10  0:21     ` David Ahern
2011-03-09 18:31 ` [PATCH 10/10] perf script: Add support for H/W and S/W events Arnaldo Carvalho de Melo

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=20110309235007.GB2533@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=acme@redhat.com \
    --cc=daahern@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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