mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Andi Kleen <andi@firstfloor.org>, Arun Sharma <asharma@fb.com>,
	Rodrigo Campos <rodrigo@sdfg.com.ar>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 01/26] perf tools: Introduce struct hist_entry_iter
Date: Thu, 29 May 2014 08:46:38 +0900	[thread overview]
Message-ID: <874n09ii01.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20140526184425.GC9699@krava.brq.redhat.com> (Jiri Olsa's message of "Mon, 26 May 2014 20:44:25 +0200")

Hi Jiri,

On Mon, 26 May 2014 20:44:25 +0200, Jiri Olsa wrote:
> On Fri, May 23, 2014 at 07:03:58PM +0900, Namhyung Kim wrote:
>> There're some duplicate code when adding hist entries.  They are
>> different in that some have branch info or mem info but generally do
>> same thing.  So introduce new struct hist_entry_iter and add callbacks
>> to customize each case in general way.
>> 
>> The new perf_evsel__add_entry() function will look like:
>> 
>>   iter->prepare_entry();
>>   iter->add_single_entry();
>> 
>>   while (iter->next_entry())
>>     iter->add_next_entry();
>> 
>>   iter->finish_entry();
>> 
>> This will help further work like the cumulative callchain patchset.
>> 
>> Tested-by: Arun Sharma <asharma@fb.com>
>> Tested-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
>> Acked-by: Jiri Olsa <jolsa@redhat.com>
>> Cc: David Ahern <dsahern@gmail.com>
>> Cc: Stephane Eranian <eranian@google.com>
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>> ---
>>  tools/perf/builtin-report.c     | 194 +++----------------------
>>  tools/perf/tests/hists_filter.c |  18 +--
>>  tools/perf/tests/hists_output.c |  11 +-
>>  tools/perf/util/hist.c          | 303 ++++++++++++++++++++++++++++++++++++++++
>>  tools/perf/util/hist.h          |  33 +++++
>>  5 files changed, 371 insertions(+), 188 deletions(-)
>> 
>> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
>> index bc0eec1ce4be..d224f5961faa 100644
>> --- a/tools/perf/builtin-report.c
>> +++ b/tools/perf/builtin-report.c
>> @@ -76,165 +76,6 @@ static int report__config(const char *var, const char *value, void *cb)
>>  	return perf_default_config(var, value, cb);
>>  }
>>  
>> -static void report__inc_stats(struct report *rep, struct hist_entry *he)
>> -{
>> -	/*
>> -	 * The @he is either of a newly created one or an existing one
>> -	 * merging current sample.  We only want to count a new one so
>> -	 * checking ->nr_events being 1.
>> -	 */
>> -	if (he->stat.nr_events == 1)
>> -		rep->nr_entries++;
>> -
>
> hm.. above is report specific counter update
>
> while below code is repeated for each iterator in finish_entry,
> maybe we should separated this and put below into a function
> called from generic part

Right.  I'll separate the generic part into a function.

The problem of calling report__inc_stats() in process_sample_event() is
that the hist_entry is no longer available.  And each mode has slightly
different behavior when accounting entries so it's inaccurate at this
stage.  Once we have the callback mechanism later in this series, it'll
be solved.

Thanks,
Namhyung

>
>> -	/*
>> -	 * Only counts number of samples at this stage as it's more
>> -	 * natural to do it here and non-sample events are also
>> -	 * counted in perf_session_deliver_event().  The dump_trace
>> -	 * requires this info is ready before going to the output tree.
>> -	 */
>> -	hists__inc_nr_events(he->hists, PERF_RECORD_SAMPLE);
>> -	if (!he->filtered)
>> -		he->hists->stats.nr_non_filtered_samples++;
>> -}
>
> jirka

  reply	other threads:[~2014-05-28 23:46 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 10:03 [PATCHSET 00/26] perf tools: Add support to accumulate hist periods (v10) Namhyung Kim
2014-05-23 10:03 ` [PATCH 01/26] perf tools: Introduce struct hist_entry_iter Namhyung Kim
2014-05-26 18:27   ` Jiri Olsa
2014-05-26 18:44   ` Jiri Olsa
2014-05-28 23:46     ` Namhyung Kim [this message]
2014-05-23 10:03 ` [PATCH 02/26] perf hists: Add support for accumulated stat of hist entry Namhyung Kim
2014-05-23 10:04 ` [PATCH 03/26] perf hists: Check if accumulated when adding a " Namhyung Kim
2014-05-23 10:04 ` [PATCH 04/26] perf hists: Accumulate hist entry stat based on the callchain Namhyung Kim
2014-05-23 10:04 ` [PATCH 05/26] perf tools: Update cpumode for each cumulative entry Namhyung Kim
2014-05-23 10:04 ` [PATCH 06/26] perf report: Cache cumulative callchains Namhyung Kim
2014-05-23 10:04 ` [PATCH 07/26] perf callchain: Add callchain_cursor_snapshot() Namhyung Kim
2014-05-23 10:04 ` [PATCH 08/26] perf tools: Save callchain info for each cumulative entry Namhyung Kim
2014-05-23 10:04 ` [PATCH 09/26] perf ui/hist: Add support to accumulated hist stat Namhyung Kim
2014-05-23 10:04 ` [PATCH 10/26] perf ui/browser: " Namhyung Kim
2014-05-26 17:52   ` Jiri Olsa
2014-05-28 23:52     ` Namhyung Kim
2014-05-23 10:04 ` [PATCH 11/26] perf ui/gtk: " Namhyung Kim
2014-05-23 10:04 ` [PATCH 12/26] perf tools: Apply percent-limit to cumulative percentage Namhyung Kim
2014-05-26 17:57   ` Jiri Olsa
2014-05-23 10:04 ` [PATCH 13/26] perf tools: Add more hpp helper functions Namhyung Kim
2014-05-23 10:04 ` [PATCH 14/26] perf report: Add --children option Namhyung Kim
2014-05-23 10:04 ` [PATCH 15/26] perf report: Add report.children config option Namhyung Kim
2014-05-23 10:04 ` [PATCH 16/26] perf tools: Do not auto-remove Children column if --fields given Namhyung Kim
2014-05-23 10:04 ` [PATCH 17/26] perf tools: Add callback function to hist_entry_iter Namhyung Kim
2014-05-23 10:04 ` [PATCH 18/26] perf top: Convert " Namhyung Kim
2014-05-23 10:04 ` [PATCH 19/26] perf top: Add --children option Namhyung Kim
2014-05-23 10:04 ` [PATCH 20/26] perf top: Add top.children config option Namhyung Kim
2014-05-23 10:04 ` [PATCH 21/26] perf tools: Enable --children option by default Namhyung Kim
2014-05-23 10:04 ` [PATCH 22/26] perf ui/stdio: Fix invalid percentage value of cumulated hist entries Namhyung Kim
2014-05-23 10:04 ` [PATCH 23/26] perf ui/gtk: Fix callchain display Namhyung Kim
2014-05-23 10:04 ` [PATCH 24/26] perf tools: Reset output/sort order to default Namhyung Kim
2014-05-23 10:04 ` [PATCH 25/26] perf tests: Define and use symbolic names for fake symbols Namhyung Kim
2014-05-23 10:04 ` [PATCH 26/26] perf tests: Add a test case for cumulating callchains 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=874n09ii01.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=asharma@fb.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=rodrigo@sdfg.com.ar \
    /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

Powered by JetHome