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


Groups > linux.kernel > #1546187 > unrolled thread

[PATCH 1/3] perf sched timehist: Enlarge default comm_width

Started byNamhyung Kim <namhyung@kernel.org>
First post2016-12-22 07:10 +0100
Last post2016-12-23 20:30 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] perf sched timehist: Enlarge default comm_width Namhyung Kim <namhyung@kernel.org> - 2016-12-22 07:10 +0100
    Re: [PATCH 1/3] perf sched timehist: Enlarge default comm_width Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-22 14:30 +0100
    [tip:perf/urgent] perf sched timehist: Honour 'comm_width' when  aligning the headers tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-23 20:30 +0100
    [tip:perf/urgent] perf sched timehist: Enlarge default 'comm_width' tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-23 20:30 +0100
    [tip:perf/urgent] perf sched timehist: Remove hardcoded  'comm_width' check at print_summary tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-23 20:30 +0100

#1546187 — [PATCH 1/3] perf sched timehist: Enlarge default comm_width

FromNamhyung Kim <namhyung@kernel.org>
Date2016-12-22 07:10 +0100
Subject[PATCH 1/3] perf sched timehist: Enlarge default comm_width
Message-ID<sR4JH-5Az-3@gated-at.bofh.it>
Current default value is 20 but it's easily changed to a bigger value as
task has a long name and different tid and pid.  And it makes the output
not aligned.  So change it to have a large value as summary shows.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-sched.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c1c07bfe132c..5052caa91caa 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1775,7 +1775,7 @@ static u64 perf_evsel__get_time(struct perf_evsel *evsel, u32 cpu)
 	return r->last_time[cpu];
 }
 
-static int comm_width = 20;
+static int comm_width = 30;
 
 static char *timehist_get_commstr(struct thread *thread)
 {
@@ -1817,7 +1817,7 @@ static void timehist_header(struct perf_sched *sched)
 		printf(" ");
 	}
 
-	printf(" %-20s  %9s  %9s  %9s",
+	printf(" %-*s  %9s  %9s  %9s", comm_width,
 		"task name", "wait time", "sch delay", "run time");
 
 	printf("\n");
@@ -1830,7 +1830,8 @@ static void timehist_header(struct perf_sched *sched)
 	if (sched->show_cpu_visual)
 		printf(" %*s ", ncpus, "");
 
-	printf(" %-20s  %9s  %9s  %9s\n", "[tid/pid]", "(msec)", "(msec)", "(msec)");
+	printf(" %-*s  %9s  %9s  %9s\n", comm_width,
+	       "[tid/pid]", "(msec)", "(msec)", "(msec)");
 
 	/*
 	 * separator
@@ -1840,7 +1841,7 @@ static void timehist_header(struct perf_sched *sched)
 	if (sched->show_cpu_visual)
 		printf(" %.*s ", ncpus, graph_dotted_line);
 
-	printf(" %.20s  %.9s  %.9s  %.9s",
+	printf(" %.*s  %.9s  %.9s  %.9s", comm_width,
 		graph_dotted_line, graph_dotted_line, graph_dotted_line,
 		graph_dotted_line);
 
@@ -2626,9 +2627,6 @@ static void timehist_print_summary(struct perf_sched *sched,
 
 	memset(&totals, 0, sizeof(totals));
 
-	if (comm_width < 30)
-		comm_width = 30;
-
 	if (sched->idle_hist) {
 		printf("\nIdle-time summary\n");
 		printf("%*s  parent  sched-out  ", comm_width, "comm");
-- 
2.10.0

[toc] | [next] | [standalone]


#1546376

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-12-22 14:30 +0100
Message-ID<sRbBv-1B3-23@gated-at.bofh.it>
In reply to#1546187
Em Thu, Dec 22, 2016 at 03:03:48PM +0900, Namhyung Kim escreveu:
> Current default value is 20 but it's easily changed to a bigger value as
> task has a long name and different tid and pid.  And it makes the output
> not aligned.  So change it to have a large value as summary shows.

So you're doing multiple things here:

1) making more places honour the comm_width (header)

2) changing its default from 20 to 30 and due to this, removing the
   setting to 30 done at timehist_print_summary

I'll break it into two to reflect that.

- Arnaldo

> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-sched.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index c1c07bfe132c..5052caa91caa 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -1775,7 +1775,7 @@ static u64 perf_evsel__get_time(struct perf_evsel *evsel, u32 cpu)
>  	return r->last_time[cpu];
>  }
>  
> -static int comm_width = 20;
> +static int comm_width = 30;
>  
>  static char *timehist_get_commstr(struct thread *thread)
>  {
> @@ -1817,7 +1817,7 @@ static void timehist_header(struct perf_sched *sched)
>  		printf(" ");
>  	}
>  
> -	printf(" %-20s  %9s  %9s  %9s",
> +	printf(" %-*s  %9s  %9s  %9s", comm_width,
>  		"task name", "wait time", "sch delay", "run time");
>  
>  	printf("\n");
> @@ -1830,7 +1830,8 @@ static void timehist_header(struct perf_sched *sched)
>  	if (sched->show_cpu_visual)
>  		printf(" %*s ", ncpus, "");
>  
> -	printf(" %-20s  %9s  %9s  %9s\n", "[tid/pid]", "(msec)", "(msec)", "(msec)");
> +	printf(" %-*s  %9s  %9s  %9s\n", comm_width,
> +	       "[tid/pid]", "(msec)", "(msec)", "(msec)");
>  
>  	/*
>  	 * separator
> @@ -1840,7 +1841,7 @@ static void timehist_header(struct perf_sched *sched)
>  	if (sched->show_cpu_visual)
>  		printf(" %.*s ", ncpus, graph_dotted_line);
>  
> -	printf(" %.20s  %.9s  %.9s  %.9s",
> +	printf(" %.*s  %.9s  %.9s  %.9s", comm_width,
>  		graph_dotted_line, graph_dotted_line, graph_dotted_line,
>  		graph_dotted_line);
>  
> @@ -2626,9 +2627,6 @@ static void timehist_print_summary(struct perf_sched *sched,
>  
>  	memset(&totals, 0, sizeof(totals));
>  
> -	if (comm_width < 30)
> -		comm_width = 30;
> -
>  	if (sched->idle_hist) {
>  		printf("\nIdle-time summary\n");
>  		printf("%*s  parent  sched-out  ", comm_width, "comm");
> -- 
> 2.10.0

[toc] | [prev] | [next] | [standalone]


#1546952 — [tip:perf/urgent] perf sched timehist: Honour 'comm_width' when aligning the headers

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-12-23 20:30 +0100
Subject[tip:perf/urgent] perf sched timehist: Honour 'comm_width' when aligning the headers
Message-ID<sRDHs-2EZ-11@gated-at.bofh.it>
In reply to#1546187
Commit-ID:  0e6758e8231d5905c2e267566e9bd679a68a7b00
Gitweb:     http://git.kernel.org/tip/0e6758e8231d5905c2e267566e9bd679a68a7b00
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 22 Dec 2016 15:03:48 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 22 Dec 2016 16:35:45 -0300

perf sched timehist: Honour 'comm_width' when aligning the headers

Current default value is 20, but that may change in the future, so make
places where we have 20 hardcoded use 'comm_width'.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
[ Split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c1c07bf..020f9c9 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1817,7 +1817,7 @@ static void timehist_header(struct perf_sched *sched)
 		printf(" ");
 	}
 
-	printf(" %-20s  %9s  %9s  %9s",
+	printf(" %-*s  %9s  %9s  %9s", comm_width,
 		"task name", "wait time", "sch delay", "run time");
 
 	printf("\n");
@@ -1830,7 +1830,8 @@ static void timehist_header(struct perf_sched *sched)
 	if (sched->show_cpu_visual)
 		printf(" %*s ", ncpus, "");
 
-	printf(" %-20s  %9s  %9s  %9s\n", "[tid/pid]", "(msec)", "(msec)", "(msec)");
+	printf(" %-*s  %9s  %9s  %9s\n", comm_width,
+	       "[tid/pid]", "(msec)", "(msec)", "(msec)");
 
 	/*
 	 * separator
@@ -1840,7 +1841,7 @@ static void timehist_header(struct perf_sched *sched)
 	if (sched->show_cpu_visual)
 		printf(" %.*s ", ncpus, graph_dotted_line);
 
-	printf(" %.20s  %.9s  %.9s  %.9s",
+	printf(" %.*s  %.9s  %.9s  %.9s", comm_width,
 		graph_dotted_line, graph_dotted_line, graph_dotted_line,
 		graph_dotted_line);
 

[toc] | [prev] | [next] | [standalone]


#1546954 — [tip:perf/urgent] perf sched timehist: Enlarge default 'comm_width'

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-12-23 20:30 +0100
Subject[tip:perf/urgent] perf sched timehist: Enlarge default 'comm_width'
Message-ID<sRDHs-2EZ-15@gated-at.bofh.it>
In reply to#1546187
Commit-ID:  9b8087d72086b249ff744cee237ad12cc5e9255d
Gitweb:     http://git.kernel.org/tip/9b8087d72086b249ff744cee237ad12cc5e9255d
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 22 Dec 2016 15:03:48 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 22 Dec 2016 16:35:45 -0300

perf sched timehist: Enlarge default 'comm_width'

Current default value is 20 but it's easily changed to a bigger value as
task has a long name and different tid and pid.  And it makes the output
not aligned.  So change it to have a large value as summary shows.

Committer notes:

Before:

  # perf sched record
  ^C
  # perf sched timehist
  <SNIP>
    40602.770537 [0001]  rcuos/2[29]               7.970      0.002      0.020
    40602.771512 [0003]  <idle>                    0.003      0.000      0.986
    40602.771586 [0001]  <idle>                    0.020      0.000      1.049
    40602.771606 [0001]  qemu-system-x86[3593/3510]      0.000      0.002      0.020
    40602.771629 [0003]  qemu-system-x86[3510]           0.000      0.003      0.116
    40602.771776 [0000]  <idle>                          0.001      0.000      1.892
  <SNIP>

After:

  # perf sched timehist
  <SNIP>
   40602.770537 [0001]  rcuos/2[29]                         7.970      0.002      0.020
   40602.771512 [0003]  <idle>                              0.003      0.000      0.986
   40602.771586 [0001]  <idle>                              0.020      0.000      1.049
   40602.771606 [0001]  qemu-system-x86[3593/3510]          0.000      0.002      0.020
   40602.771629 [0003]  qemu-system-x86[3510]               0.000      0.003      0.116
  <SNIP>

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
[ Split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 020f9c9..c65f16c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1775,7 +1775,7 @@ static u64 perf_evsel__get_time(struct perf_evsel *evsel, u32 cpu)
 	return r->last_time[cpu];
 }
 
-static int comm_width = 20;
+static int comm_width = 30;
 
 static char *timehist_get_commstr(struct thread *thread)
 {

[toc] | [prev] | [next] | [standalone]


#1546955 — [tip:perf/urgent] perf sched timehist: Remove hardcoded 'comm_width' check at print_summary

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-12-23 20:30 +0100
Subject[tip:perf/urgent] perf sched timehist: Remove hardcoded 'comm_width' check at print_summary
Message-ID<sRDHs-2EZ-25@gated-at.bofh.it>
In reply to#1546187
Commit-ID:  4fa0d1aa2711a5053fb2422331bdf6bce99b5f87
Gitweb:     http://git.kernel.org/tip/4fa0d1aa2711a5053fb2422331bdf6bce99b5f87
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 22 Dec 2016 15:03:48 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 22 Dec 2016 16:35:46 -0300

perf sched timehist: Remove hardcoded 'comm_width' check at print_summary

Now that the default 'comm_width' value is 30, no need to check that at
print_summary,

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
[ Split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c65f16c..5052caa 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2627,9 +2627,6 @@ static void timehist_print_summary(struct perf_sched *sched,
 
 	memset(&totals, 0, sizeof(totals));
 
-	if (comm_width < 30)
-		comm_width = 30;
-
 	if (sched->idle_hist) {
 		printf("\nIdle-time summary\n");
 		printf("%*s  parent  sched-out  ", comm_width, "comm");

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web