All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Yunlong Song <yunlong.song@huawei.com>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@redhat.com,
	acme@kernel.org, linux-kernel@vger.kernel.org,
	wangnan0@huawei.com
Subject: Re: [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report
Date: Mon, 23 Mar 2015 09:44:33 +0900	[thread overview]
Message-ID: <20150323004433.GD2782@sejong> (raw)
In-Reply-To: <1426773512-27350-1-git-send-email-yunlong.song@huawei.com>

Hi Yunlong,

On Thu, Mar 19, 2015 at 09:58:32PM +0800, Yunlong Song wrote:
> When '--sort' is not set, 'perf mem report" will print a null pointer as
> the output value of sort order, so fix it.
> 
> Example:
> 
> Before this patch:
> 
>  $ perf mem report
>  # To display the perf.data header info, please use --header/--header-only options.
>  #
>  # Samples: 18  of event 'cpu/mem-loads/pp'
>  # Total weight : 188
>  # Sort order   : (null)
>  #
>  ...
> 
> After this patch:
> 
>  $ perf mem report
>  # To display the perf.data header info, please use --header/--header-only options.
>  #
>  # Samples: 18  of event 'cpu/mem-loads/pp'
>  # Total weight : 188
>  #
>  ...

I think it'd be better to show default sort order in this case.


> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  tools/perf/builtin-report.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 52f74e1..918ffef 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -304,7 +304,8 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
>  
>  	if (rep->mem_mode) {
>  		ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
> -		ret += fprintf(fp, "\n# Sort order   : %s", sort_order);
> +		if (sort_order)
> +			ret += fprintf(fp, "\n# Sort order   : %s", sort_order);

Something like this?

		ret += fprintf(fp, "\n# Sort order   : %s", sort_order ?: default_mem_sort_order);

Thanks,
Namhyung


>  	} else
>  		ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
>  	return ret + fprintf(fp, "\n#\n");
> -- 
> 1.8.5.2
> 
> --
> 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/

  reply	other threads:[~2015-03-23  0:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 13:58 [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report Yunlong Song
2015-03-23  0:44 ` Namhyung Kim [this message]
2015-03-23  3:50   ` [PATCH v2] " Yunlong Song
2015-03-23 16:15     ` Arnaldo Carvalho de Melo
2015-03-23 23:38       ` Namhyung Kim
2015-03-24  2:03       ` Yunlong Song
2015-03-24 16:30     ` [tip:perf/core] " tip-bot for Yunlong Song
2015-03-23  3:58   ` [PATCH] " Yunlong Song

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=20150323004433.GD2782@sejong \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=wangnan0@huawei.com \
    --cc=yunlong.song@huawei.com \
    /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.