Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261317

Re: [PATCH v3 4/4] perf report: Add callchain value option

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 4/4] perf report: Add callchain value option
Date 2015-11-03 10:10 +0100
Message-ID <qqFLk-Gf-7@gated-at.bofh.it> (permalink)
References <qqEcy-83d-7@gated-at.bofh.it> <qqEcz-83d-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Nov 03, 2015 at 04:18:31PM +0900, Namhyung Kim wrote:

SNIP

> @@ -819,12 +837,26 @@ char *callchain_node__sprintf_value(struct callchain_node *node,
>  				    char *bf, size_t bfsize, u64 total)
>  {
>  	double percent = 0.0;
> -	u64 cumul = callchain_cumul_hits(node);
> +	u64 period = callchain_cumul_hits(node);
> +	int count = callchain_cumul_counts(node);
>  
>  	if (total)
> -		percent = cumul * 100.0 / total;
> +		percent = period * 100.0 / total;
> +	if (callchain_param.mode == CHAIN_FOLDED)
> +		count = node->count;

this could be set/computed below in respective cases

>  
> -	scnprintf(bf, bfsize, "%6.2f%%", percent);
> +	switch (callchain_param.value) {
> +	case CCVAL_PERIOD:
> +		scnprintf(bf, bfsize, "%"PRIu64, period);
> +		break;
> +	case CCVAL_COUNT:
> +		scnprintf(bf, bfsize, "%u", count);
> +		break;
> +	case CCVAL_PERCENT:
> +	default:
> +		scnprintf(bf, bfsize, "%.2f%%", percent);
> +		break;
> +	}
>  	return bf;
>  }
>  
> @@ -832,12 +864,24 @@ int callchain_node__fprintf_value(struct callchain_node *node,
>  				 FILE *fp, u64 total)
>  {
>  	double percent = 0.0;
> -	u64 cumul = callchain_cumul_hits(node);
> +	u64 period = callchain_cumul_hits(node);
> +	int count = callchain_cumul_counts(node);
>  
>  	if (total)
> -		percent = cumul * 100.0 / total;
> -
> -	return percent_color_fprintf(fp, "%.2f%%", percent);
> +		percent = period * 100.0 / total;
> +	if (callchain_param.mode == CHAIN_FOLDED)
> +		count = node->count;
> +

ditto

jirka

> +	switch (callchain_param.value) {
> +	case CCVAL_PERIOD:
> +		return fprintf(fp, "%"PRIu64, period);
> +	case CCVAL_COUNT:
> +		return fprintf(fp, "%u", count);
> +	case CCVAL_PERCENT:
> +	default:
> +		return percent_color_fprintf(fp, "%.2f%%", percent);
> +	}
> +	return 0;
>  }
>  

SNIP
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] perf report: Support folded callchain output (v3) Namhyung Kim <namhyung@kernel.org> - 2015-11-03 08:30 +0100
  [PATCH v3 3/4] perf callchain: Add count fields to struct callchain_node Namhyung Kim <namhyung@kernel.org> - 2015-11-03 08:30 +0100
    Re: [PATCH v3 3/4] perf callchain: Add count fields to struct  callchain_node Jiri Olsa <jolsa@redhat.com> - 2015-11-03 10:10 +0100
  [PATCH v3 4/4] perf report: Add callchain value option Namhyung Kim <namhyung@kernel.org> - 2015-11-03 08:30 +0100
    Re: [PATCH v3 4/4] perf report: Add callchain value option Jiri Olsa <jolsa@redhat.com> - 2015-11-03 10:10 +0100
      Re: [PATCH v3 4/4] perf report: Add callchain value option Namhyung Kim <namhyung@kernel.org> - 2015-11-03 12:00 +0100
        Re: [PATCH v3 4/4] perf report: Add callchain value option Jiri Olsa <jolsa@redhat.com> - 2015-11-03 12:20 +0100
    Re: [PATCH v3 4/4] perf report: Add callchain value option Jiri Olsa <jolsa@redhat.com> - 2015-11-03 10:10 +0100

csiph-web