All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: kan.liang@linux.intel.com
Cc: acme@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org,
	namhyung@kernel.org, eranian@google.com, ak@linux.intel.com,
	mark.rutland@arm.com, will@kernel.org, mpe@ellerman.id.au
Subject: Re: [PATCH V2 03/12] perf script: Support data page size
Date: Sat, 5 Dec 2020 00:27:39 +0100	[thread overview]
Message-ID: <20201204232739.GI3613628@krava> (raw)
In-Reply-To: <20201130172803.2676-4-kan.liang@linux.intel.com>

On Mon, Nov 30, 2020 at 09:27:54AM -0800, kan.liang@linux.intel.com wrote:

SNIP

>  #endif /* __PERF_RECORD_H */
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 5cc722b6fe7c..e73f579f31d3 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1260,10 +1260,30 @@ static void dump_event(struct evlist *evlist, union perf_event *event,
>  	       event->header.size, perf_event__name(event->header.type));
>  }
>  
> +char *get_page_size_name(u64 size, char *str)
> +{
> +	const char suffixes[5] = { 'B', 'K', 'M', 'G', 'T' };
> +	int i;
> +
> +	if (size == 0) {
> +		snprintf(str, PAGE_SIZE_NAME_LEN, "%s", "N/A");
> +		return str;
> +	}
> +	for (i = 0; i < 5; i++) {
> +		if (size < 1024)
> +			break;
> +		size /= 1024;
> +	}
> +
> +	snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> +	return str;
> +}

we have the same code in unit_number__scnprintf,
you just need to add support for 'T' and 'N/A'

jirka


  reply	other threads:[~2020-12-04 23:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 17:27 [PATCH V2 00/12] Add the page size in the perf record (user tools) kan.liang
2020-11-30 17:27 ` [PATCH V2 01/12] tools headers UAPI: Update tools's copy of linux/perf_event.h kan.liang
2020-12-07 16:52   ` Arnaldo Carvalho de Melo
2020-11-30 17:27 ` [PATCH V2 02/12] perf record: Support new sample type for data page size kan.liang
2020-12-07 17:07   ` Arnaldo Carvalho de Melo
2020-12-07 20:25     ` Liang, Kan
2020-12-16 15:49       ` Arnaldo Carvalho de Melo
2020-11-30 17:27 ` [PATCH V2 03/12] perf script: Support " kan.liang
2020-12-04 23:27   ` Jiri Olsa [this message]
2020-11-30 17:27 ` [PATCH V2 04/12] perf sort: Add sort option for " kan.liang
2020-11-30 17:27 ` [PATCH V2 05/12] perf mem: Factor out a function to generate sort order kan.liang
2020-12-04 23:27   ` Jiri Olsa
2020-11-30 17:27 ` [PATCH V2 06/12] perf mem: Clean up output format kan.liang
2020-12-04 23:27   ` Jiri Olsa
2020-12-07 20:19     ` Liang, Kan
2020-12-08 10:29       ` Jiri Olsa
2020-11-30 17:27 ` [PATCH V2 07/12] perf mem: Support data page size kan.liang
2020-11-30 17:27 ` [PATCH V2 08/12] perf test: Add test case for PERF_SAMPLE_DATA_PAGE_SIZE kan.liang
2020-11-30 17:28 ` [PATCH V2 09/12] perf tools: Add support for PERF_SAMPLE_CODE_PAGE_SIZE kan.liang
2020-11-30 17:28 ` [PATCH V2 10/12] perf script: " kan.liang
2020-11-30 17:28 ` [PATCH V2 11/12] perf report: " kan.liang
2020-11-30 17:28 ` [PATCH V2 12/12] perf test: Add test case " kan.liang
2020-12-08 10:31 ` [PATCH V2 00/12] Add the page size in the perf record (user tools) Jiri Olsa
  -- strict thread matches above, loose matches on Subject: below --
2019-01-23 15:15 [PATCH V2 01/12] perf/core, x86: Add PERF_SAMPLE_DATA_PAGE_SIZE kan.liang
2019-01-23 15:15 ` [PATCH V2 03/12] perf script: Support data page size kan.liang

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=20201204232739.GI3613628@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=will@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.