All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report
@ 2015-03-19 13:58 Yunlong Song
  2015-03-23  0:44 ` Namhyung Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Yunlong Song @ 2015-03-19 13:58 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme; +Cc: linux-kernel, wangnan0

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
 #
 ...

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report
  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
  2015-03-23  3:50   ` [PATCH v2] " Yunlong Song
  2015-03-23  3:58   ` [PATCH] " Yunlong Song
  0 siblings, 2 replies; 8+ messages in thread
From: Namhyung Kim @ 2015-03-23  0:44 UTC (permalink / raw)
  To: Yunlong Song; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel, wangnan0

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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] perf tools: Remove (null) value of "Sort order" for perf mem report
  2015-03-23  0:44 ` Namhyung Kim
@ 2015-03-23  3:50   ` Yunlong Song
  2015-03-23 16:15     ` Arnaldo Carvalho de Melo
  2015-03-24 16:30     ` [tip:perf/core] " tip-bot for Yunlong Song
  2015-03-23  3:58   ` [PATCH] " Yunlong Song
  1 sibling, 2 replies; 8+ messages in thread
From: Yunlong Song @ 2015-03-23  3:50 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme; +Cc: linux-kernel, wangnan0, namhyung

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
 # Sort order   : local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked
 #
 ...

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 2 +-
 tools/perf/util/sort.h      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0ae4826..81c2f3b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -304,7 +304,7 @@ 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);
+		ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : default_mem_sort_order);
 	} else
 		ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
 	return ret + fprintf(fp, "\n#\n");
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 9c01b83..846036a 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -44,6 +44,7 @@ extern struct sort_entry sort_dso_to;
 extern struct sort_entry sort_sym_from;
 extern struct sort_entry sort_sym_to;
 extern enum sort_type sort__first_dimension;
+extern const char default_mem_sort_order[];
 
 struct he_stat {
 	u64			period;
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report
  2015-03-23  0:44 ` Namhyung Kim
  2015-03-23  3:50   ` [PATCH v2] " Yunlong Song
@ 2015-03-23  3:58   ` Yunlong Song
  1 sibling, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2015-03-23  3:58 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel, wangnan0

On 2015/3/23 8:44, Namhyung Kim wrote:
> 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.
> 
> 

Agree, I have changed that into a default sort order in PATCH v2, thanks.

-- 
Thanks,
Yunlong Song


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] perf tools: Remove (null) value of "Sort order" for perf mem report
  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
  1 sibling, 2 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-23 16:15 UTC (permalink / raw)
  To: Yunlong Song
  Cc: a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0, namhyung

Em Mon, Mar 23, 2015 at 11:50:05AM +0800, Yunlong Song escreveu:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Humm, this doesn't seem to apply (Namhyung's S-o-B), as this patch was
made by you and is not going thru him, right? And I haven't seen him
providing any endorsement tags.

Can you clarify?

I tested the change and it works for me, btw.

- Arnaldo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] perf tools: Remove (null) value of "Sort order" for perf mem report
  2015-03-23 16:15     ` Arnaldo Carvalho de Melo
@ 2015-03-23 23:38       ` Namhyung Kim
  2015-03-24  2:03       ` Yunlong Song
  1 sibling, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2015-03-23 23:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Yunlong Song, a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0

On Mon, Mar 23, 2015 at 01:15:32PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 23, 2015 at 11:50:05AM +0800, Yunlong Song escreveu:
> > Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Humm, this doesn't seem to apply (Namhyung's S-o-B), as this patch was
> made by you and is not going thru him, right? And I haven't seen him
> providing any endorsement tags.
> 
> Can you clarify?

This patch is from Yunlong and I just gave a feedback.  So I think the
S-o-b can be changed to:

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> 
> I tested the change and it works for me, btw.
> 
> - Arnaldo
> --
> 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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] perf tools: Remove (null) value of "Sort order" for perf mem report
  2015-03-23 16:15     ` Arnaldo Carvalho de Melo
  2015-03-23 23:38       ` Namhyung Kim
@ 2015-03-24  2:03       ` Yunlong Song
  1 sibling, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2015-03-24  2:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0, namhyung

On 2015/3/24 0:15, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 23, 2015 at 11:50:05AM +0800, Yunlong Song escreveu:
>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Humm, this doesn't seem to apply (Namhyung's S-o-B), as this patch was
> made by you and is not going thru him, right? And I haven't seen him
> providing any endorsement tags.
> 
> Can you clarify?
> 
> I tested the change and it works for me, btw.
> 
> - Arnaldo
> 
> .
> 
Got it, Namhyung has added his acked-by, thanks.

-- 
Thanks,
Yunlong Song


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:perf/core] perf tools: Remove (null) value of "Sort order" for perf mem report
  2015-03-23  3:50   ` [PATCH v2] " Yunlong Song
  2015-03-23 16:15     ` Arnaldo Carvalho de Melo
@ 2015-03-24 16:30     ` tip-bot for Yunlong Song
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Yunlong Song @ 2015-03-24 16:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, yunlong.song, acme, a.p.zijlstra,
	mingo, wangnan0, namhyung, tglx

Commit-ID:  228f14f2cbf481e0ec0bd0c7f947383cfa2d5167
Gitweb:     http://git.kernel.org/tip/228f14f2cbf481e0ec0bd0c7f947383cfa2d5167
Author:     Yunlong Song <yunlong.song@huawei.com>
AuthorDate: Mon, 23 Mar 2015 11:50:05 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 24 Mar 2015 12:06:55 -0300

perf tools: Remove (null) value of "Sort order" for perf mem report

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
 # Sort order   : local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked
 #
 ...

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1427082605-12881-1-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 2 +-
 tools/perf/util/sort.h      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0ae4826..81c2f3b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -304,7 +304,7 @@ 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);
+		ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : default_mem_sort_order);
 	} else
 		ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
 	return ret + fprintf(fp, "\n#\n");
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 9c01b83..846036a 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -44,6 +44,7 @@ extern struct sort_entry sort_dso_to;
 extern struct sort_entry sort_sym_from;
 extern struct sort_entry sort_sym_to;
 extern enum sort_type sort__first_dimension;
+extern const char default_mem_sort_order[];
 
 struct he_stat {
 	u64			period;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-24 16:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.