lkml.org 
[lkml]   [2014]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/21] perf hists: Add support for accumulated stat of hist entry
On Tue, Dec 24, 2013 at 05:22:09PM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> Maintain accumulated stat information in hist_entry->stat_acc if
> symbol_conf.cumulate_callchain is set. Fields in ->stat_acc have same
> vaules initially, and will be updated as callchain is processed later.
>
> Cc: Arun Sharma <asharma@fb.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/hist.c | 18 ++++++++++++++++++
> tools/perf/util/sort.h | 1 +
> tools/perf/util/symbol.h | 1 +
> 3 files changed, 20 insertions(+)
>
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index 283aa1972b4f..b61e2fa42412 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -237,6 +237,8 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
> return true;
>
> he_stat__decay(&he->stat);
> + if (symbol_conf.cumulate_callchain)
> + he_stat__decay(he->stat_acc);
>
> if (!he->filtered)
> hists->stats.total_period -= prev_period - he->stat.period;
> @@ -284,6 +286,15 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
> if (he != NULL) {
> *he = *template;
>
> + if (symbol_conf.cumulate_callchain) {
> + he->stat_acc = malloc(sizeof(he->stat));
> + if (he->stat_acc == NULL) {
> + free(he);
> + return NULL;
> + }
> + memcpy(he->stat_acc, &he->stat, sizeof(he->stat));
> + }
> +
> if (he->ms.map)
> he->ms.map->referenced = true;
>
> @@ -295,6 +306,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
> */
> he->branch_info = malloc(sizeof(*he->branch_info));
> if (he->branch_info == NULL) {
> + free(he->stat_acc);

probably not big deal but above free should be under
symbol_conf.cumulate_callchain check..

jirka


\
 
 \ /
  Last update: 2014-01-05 18:01    [W:1.334 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site