All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-22 11:45 Austin Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Austin Zhang @ 2013-01-22 11:45 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 8774 bytes --]

Hi, list,

Just find I just click 'reply-to' to ss, and doesn't cc/to
powertop(a)lists.01.org in this thread for those before feedback, sorry for
this.

Copy to here so that maybe Igor has comments also:

>Hm, I'm sure I've seen this before. Was it the same patch from you?
No, I didn't watch those patches from mailling list, just found this issue
in my daily working and then work out this patch. And I also didn't send it
before.

>Ok, I found it: "Display all P-states in HTML-report"
(http://lists.01.org/pipermail/powertop/2012-July/000161.html).
Thanks, just read it, it is only for pstates and this patch is learning the
same way from the mentioned codes. Seemed Igor and I encounter the same
situation for ARM and IA respectively :-)
Is the 2 patches conflict? I use the latest codes base from github.
Or the same fixing from igor is pending in the pool?

>but I'm not sure that CPUs with more than 10 C-states exists.
Yes, I am not sure the ARM case like igor is facing, for IA, yes.


2013/1/22 Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

> On (01/22/13 18:40), Austin Zhang wrote:
> > Date: Tue, 22 Jan 2013 18:40:03 +0800
> > From: Austin Zhang <zhang.austin(a)gmail.com>
> > To: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
> > Subject: Re: [Powertop] [PATCH] Fix C states and P states presentation
> >  issue.
> >
> >    Sergey,
> >    Thanks for your review and comments, I will send out V2 by this. �
> >
>
> thank you,
>
>         -ss
>
>
> >    2013/1/22 Sergey Senozhatsky <[1]sergey.senozhatsky(a)gmail.com>
> >
> >      On (01/15/13 19:05), Austin Zhang wrote:
> >      > Date: Tue, 15 Jan 2013 19:05:18 +0800
> >      > From: Austin Zhang <[2]zhang.austin(a)gmail.com>
> >      > To: [3]powertop(a)lists.01.org
> >      > Subject: [Powertop] [PATCH] Fix C states and P states presentation
> >      issue.
> >      > X-Mailer: git-send-email 1.7.5.4
> >      >
> >      > If using '10' in this 'for' loop, for P states, once the processor
> >      > provides more than 10 P states, those additional ones cannot been
> >      > presented; and for C states, once the processor provides maximize
> >      > C states level more than 9, for example, it only has POLL, C1, C3,
> >      > C6, C10, the additional one like C10 also cannot be presented.
> >      >
> >      > Now we get the loop numbers from the system information we had got
> >      > before.
> >      >
> >      > Signed-off-by: Austin Zhang <[4]zhang.austin(a)gmail.com>
> >      > ---
> >      > �src/cpu/cpu.cpp | � 35 +++++++++++++++++++++++++++++------
> >      > �1 files changed, 29 insertions(+), 6 deletions(-)
> >      >
> >      > diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> >      > index 7f3af69..28f77b7 100644
> >      > --- a/src/cpu/cpu.cpp
> >      > +++ b/src/cpu/cpu.cpp
> >      > @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
> >      > � � � unsigned int package, core, cpu;
> >      > � � � int line;
> >      > � � � class abstract_cpu *_package, * _core, * _cpu;
> >      > + � � unsigned int i, j, cstates_num;
> >      > +
> >      > + � � for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> >      > + � � � � � � if (all_cpus[i])
> >      > + � � � � � � � � � � for (j = 0; j < all_cpus[i]->cstates.size();
> >      j++)
> >      > + � � � � � � � � � � � � � � if
> >      ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> >      > + � � � � � � � � � � � � � � � �
> >      (all_cpus[i]->cstates[j])->line_level > cstates_num)
> >      > + � � � � � � � � � � � � � � � � � � cstates_num =
> >      (all_cpus[i]->cstates[j])->line_level;
> >      > + � � }
> >      >
> >
> >      how about removing this `if' condition?
> >      � � � � for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> >      � � � � � � � � cstates_num = std::max(cstates_num,
> >      (all_cpus[i]->cstates[j])->line_level);
> >
> >      > � � � report.begin_section(SECTION_CPUIDLE);
> >      > � � � report.add_header("Processor Idle state report");
> >      > @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
> >      > � � � � � � � � � � � if (!_core)
> >      > � � � � � � � � � � � � � � � continue;
> >      >
> >      > - � � � � � � � � � � for (line = LEVEL_HEADER; line < 10;
> line++) {
> >      > + � � � � � � � � � � for (line = LEVEL_HEADER; line <=
> >      (int)cstates_num; line++) {
> >      > � � � � � � � � � � � � � � � bool first_cpu = true;
> >      >
> >      > � � � � � � � � � � � � � � � if
> (!_package->has_cstate_level(line))
> >      > @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
> >      > � � � char buffer[128];
> >      > � � � char linebuf[1024];
> >      > � � � unsigned int package, core, cpu;
> >      > - � � int line;
> >      > + � � int line, loop;
> >      > � � � class abstract_cpu *_package, * _core, * _cpu;
> >      > � � � int ctr = 0;
> >      > + � � unsigned int i, j, cstates_num, pstates_num;
> >      > +
> >      > + � � for (i = 0, cstates_num = 0, pstates_num = 0; i <
> >      all_cpus.size(); i++) {
> >
> >      we have two all_cpus[i] checks in one for loop, let's change to
> single
> >      `if (!all_cpus[i]) continue;'
> >
> >      > + � � � � � � if (all_cpus[i] && all_cpus[i]->pstates.size() >
> >      pstates_num)
> >      > + � � � � � � � � � � pstates_num = all_cpus[i]->pstates.size();
> >      >
> >
> >      � � � � pstates_num = std::max(pstates_num,
> all_cpus[i]->pstates.size())
> >
> >      > - � � if (state == PSTATE)
> >      > + � � � � � � if (all_cpus[i])
> >      > + � � � � � � � � � � for (j = 0; j < all_cpus[i]->cstates.size();
> >      j++)
> >      > + � � � � � � � � � � � � � � if
> >      ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> >      > + � � � � � � � � � � � � � � � �
> >      (all_cpus[i]->cstates[j])->line_level > cstates_num)
> >      > + � � � � � � � � � � � � � � � � � � cstates_num =
> >      (all_cpus[i]->cstates[j])->line_level;
> >
> >      � � � � for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> >      � � � � � � � � cstates_num = std::max(cstates_num,
> >      (all_cpus[i]->cstates[j])->line_level)
> >
> >      � � � � -ss
> >
> >      > + � � }
> >      > +
> >      > + � � if (state == PSTATE) {
> >      > � � � � � � � win = get_ncurses_win("Frequency stats");
> >      > - � � else
> >      > + � � � � � � loop = (int)pstates_num;
> >      > + � � } else {
> >      > � � � � � � � win = get_ncurses_win("Idle stats");
> >      > + � � � � � � loop = (int)cstates_num;
> >      > + � � }
> >      >
> >      > � � � if (!win)
> >      > � � � � � � � return;
> >      > @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
> >      > � � � � � � � � � � � if (!_core->has_pstates() && state ==
> PSTATE)
> >      > � � � � � � � � � � � � � � � continue;
> >      >
> >      > -
> >      > - � � � � � � � � � � for (line = LEVEL_HEADER; line < 10;
> line++) {
> >      > + � � � � � � � � � � for (line = LEVEL_HEADER; line <= loop;
> line++)
> >      {
> >      > � � � � � � � � � � � � � � � int first = 1;
> >      > � � � � � � � � � � � � � � � ctr = 0;
> >      > � � � � � � � � � � � � � � � linebuf[0] = 0;
> >      > --
> >      > 1.7.5.4
> >      >
> >      > _______________________________________________
> >      > PowerTop mailing list
> >      > [5]PowerTop(a)lists.01.org
> >      > [6]https://lists.01.org/mailman/listinfo/powertop
> >      >
> >
> > References
> >
> >    Visible links
> >    1. mailto:sergey.senozhatsky(a)gmail.com
> >    2. mailto:zhang.austin(a)gmail.com
> >    3. mailto:powertop(a)lists.01.org
> >    4. mailto:zhang.austin(a)gmail.com
> >    5. mailto:PowerTop(a)lists.01.org
> >    6. https://lists.01.org/mailman/listinfo/powertop
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 12329 bytes --]

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

* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-22  8:19 Sergey Senozhatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2013-01-22  8:19 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 4070 bytes --]

On (01/15/13 19:05), Austin Zhang wrote:
> Date: Tue, 15 Jan 2013 19:05:18 +0800
> From: Austin Zhang <zhang.austin(a)gmail.com>
> To: powertop(a)lists.01.org
> Subject: [Powertop] [PATCH] Fix C states and P states presentation issue.
> X-Mailer: git-send-email 1.7.5.4
> 
> If using '10' in this 'for' loop, for P states, once the processor
> provides more than 10 P states, those additional ones cannot been
> presented; and for C states, once the processor provides maximize
> C states level more than 9, for example, it only has POLL, C1, C3,
> C6, C10, the additional one like C10 also cannot be presented.
> 
> Now we get the loop numbers from the system information we had got
> before.
> 
> Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
> ---
>  src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
>  1 files changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> index 7f3af69..28f77b7 100644
> --- a/src/cpu/cpu.cpp
> +++ b/src/cpu/cpu.cpp
> @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
>  	unsigned int package, core, cpu;
>  	int line;
>  	class abstract_cpu *_package, * _core, * _cpu;
> +	unsigned int i, j, cstates_num;
> +
> +	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> +	}
>  

how about removing this `if' condition?
	for (j = 0; j < all_cpus[i]->cstates.size(); j++)
		cstates_num = std::max(cstates_num, (all_cpus[i]->cstates[j])->line_level);




>  	report.begin_section(SECTION_CPUIDLE);
>  	report.add_header("Processor Idle state report");
> @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
>  			if (!_core)
>  				continue;
>  
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
>  				bool first_cpu = true;
>  
>  				if (!_package->has_cstate_level(line))
> @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
>  	char buffer[128];
>  	char linebuf[1024];
>  	unsigned int package, core, cpu;
> -	int line;
> +	int line, loop;
>  	class abstract_cpu *_package, * _core, * _cpu;
>  	int ctr = 0;
> +	unsigned int i, j, cstates_num, pstates_num;
> +
> +	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {


we have two all_cpus[i] checks in one for loop, let's change to single `if (!all_cpus[i]) continue;'




> +		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
> +			pstates_num = all_cpus[i]->pstates.size();
>  

	pstates_num = std::max(pstates_num, all_cpus[i]->pstates.size())


> -	if (state == PSTATE)
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;


	for (j = 0; j < all_cpus[i]->cstates.size(); j++)
		cstates_num = std::max(cstates_num, (all_cpus[i]->cstates[j])->line_level)


	-ss


> +	}
> +
> +	if (state == PSTATE) {
>  		win = get_ncurses_win("Frequency stats");
> -	else
> +		loop = (int)pstates_num;
> +	} else {
>  		win = get_ncurses_win("Idle stats");
> +		loop = (int)cstates_num;
> +	}
>  
>  	if (!win)
>  		return;
> @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
>  			if (!_core->has_pstates() && state == PSTATE)
>  				continue;
>  
> -
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= loop; line++) {
>  				int first = 1;
>  				ctr = 0;
>  				linebuf[0] = 0;
> -- 
> 1.7.5.4
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

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

* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-21 12:35 Sergey Senozhatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2013-01-21 12:35 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 4120 bytes --]

On (01/21/13 15:31), Sergey Senozhatsky wrote:
> On (01/15/13 19:05), Austin Zhang wrote:
> > Date: Tue, 15 Jan 2013 19:05:18 +0800
> > From: Austin Zhang <zhang.austin(a)gmail.com>
> > To: powertop(a)lists.01.org
> > Subject: [Powertop] [PATCH] Fix C states and P states presentation issue.
> > X-Mailer: git-send-email 1.7.5.4
> > 
> > If using '10' in this 'for' loop, for P states, once the processor
> > provides more than 10 P states, those additional ones cannot been
> > presented; and for C states, once the processor provides maximize
> > C states level more than 9, for example, it only has POLL, C1, C3,
> > C6, C10, the additional one like C10 also cannot be presented.
> > 
> > Now we get the loop numbers from the system information we had got
> > before.
> > 
> > Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
> > ---
> >  src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
> >  1 files changed, 29 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> > index 7f3af69..28f77b7 100644
> > --- a/src/cpu/cpu.cpp
> > +++ b/src/cpu/cpu.cpp
> > @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
> >  	unsigned int package, core, cpu;
> >  	int line;
> >  	class abstract_cpu *_package, * _core, * _cpu;
> > +	unsigned int i, j, cstates_num;
> > +
> > +	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> > +		if (all_cpus[i])
> > +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> > +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> > +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> > +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> > +	}
> >  
> >  	report.begin_section(SECTION_CPUIDLE);
> >  	report.add_header("Processor Idle state report");
> > @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
> >  			if (!_core)
> >  				continue;
> >  
> > -			for (line = LEVEL_HEADER; line < 10; line++) {
> > +			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
> >  				bool first_cpu = true;
> >  
> >  				if (!_package->has_cstate_level(line))
> > @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
> >  	char buffer[128];
> >  	char linebuf[1024];
> >  	unsigned int package, core, cpu;
> > -	int line;
> > +	int line, loop;
> >  	class abstract_cpu *_package, * _core, * _cpu;
> >  	int ctr = 0;
> > +	unsigned int i, j, cstates_num, pstates_num;
> > +
> > +	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {
> > +		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
> > +			pstates_num = all_cpus[i]->pstates.size();
> >  
> > -	if (state == PSTATE)
> > +		if (all_cpus[i])
> > +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> > +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> > +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> > +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> > +	}
> > +
> 
> Hm, I think it'd be better to have these (cstates_num, pstates_num) as a cpu members and set max 
> P/C state when we insert new P/C state. Iterating through constant data on every display(/report)
> seems like overkill.
> 

Oops my bad, don't mention it. Eventually we reset this data.

	-ss

> 
> 
> > +	if (state == PSTATE) {
> >  		win = get_ncurses_win("Frequency stats");
> > -	else
> > +		loop = (int)pstates_num;
> > +	} else {
> >  		win = get_ncurses_win("Idle stats");
> > +		loop = (int)cstates_num;
> > +	}
> >  
> >  	if (!win)
> >  		return;
> > @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
> >  			if (!_core->has_pstates() && state == PSTATE)
> >  				continue;
> >  
> > -
> > -			for (line = LEVEL_HEADER; line < 10; line++) {
> > +			for (line = LEVEL_HEADER; line <= loop; line++) {
> >  				int first = 1;
> >  				ctr = 0;
> >  				linebuf[0] = 0;
> > -- 
> > 1.7.5.4
> > 
> > _______________________________________________
> > PowerTop mailing list
> > PowerTop(a)lists.01.org
> > https://lists.01.org/mailman/listinfo/powertop
> > 

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

* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-21 12:31 Sergey Senozhatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2013-01-21 12:31 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3787 bytes --]

On (01/15/13 19:05), Austin Zhang wrote:
> Date: Tue, 15 Jan 2013 19:05:18 +0800
> From: Austin Zhang <zhang.austin(a)gmail.com>
> To: powertop(a)lists.01.org
> Subject: [Powertop] [PATCH] Fix C states and P states presentation issue.
> X-Mailer: git-send-email 1.7.5.4
> 
> If using '10' in this 'for' loop, for P states, once the processor
> provides more than 10 P states, those additional ones cannot been
> presented; and for C states, once the processor provides maximize
> C states level more than 9, for example, it only has POLL, C1, C3,
> C6, C10, the additional one like C10 also cannot be presented.
> 
> Now we get the loop numbers from the system information we had got
> before.
> 
> Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
> ---
>  src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
>  1 files changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> index 7f3af69..28f77b7 100644
> --- a/src/cpu/cpu.cpp
> +++ b/src/cpu/cpu.cpp
> @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
>  	unsigned int package, core, cpu;
>  	int line;
>  	class abstract_cpu *_package, * _core, * _cpu;
> +	unsigned int i, j, cstates_num;
> +
> +	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> +	}
>  
>  	report.begin_section(SECTION_CPUIDLE);
>  	report.add_header("Processor Idle state report");
> @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
>  			if (!_core)
>  				continue;
>  
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
>  				bool first_cpu = true;
>  
>  				if (!_package->has_cstate_level(line))
> @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
>  	char buffer[128];
>  	char linebuf[1024];
>  	unsigned int package, core, cpu;
> -	int line;
> +	int line, loop;
>  	class abstract_cpu *_package, * _core, * _cpu;
>  	int ctr = 0;
> +	unsigned int i, j, cstates_num, pstates_num;
> +
> +	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {
> +		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
> +			pstates_num = all_cpus[i]->pstates.size();
>  
> -	if (state == PSTATE)
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> +	}
> +

Hm, I think it'd be better to have these (cstates_num, pstates_num) as a cpu members and set max 
P/C state when we insert new P/C state. Iterating through constant data on every display(/report)
seems like overkill.

	-ss


> +	if (state == PSTATE) {
>  		win = get_ncurses_win("Frequency stats");
> -	else
> +		loop = (int)pstates_num;
> +	} else {
>  		win = get_ncurses_win("Idle stats");
> +		loop = (int)cstates_num;
> +	}
>  
>  	if (!win)
>  		return;
> @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
>  			if (!_core->has_pstates() && state == PSTATE)
>  				continue;
>  
> -
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= loop; line++) {
>  				int first = 1;
>  				ctr = 0;
>  				linebuf[0] = 0;
> -- 
> 1.7.5.4
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

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

* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-15 11:28 Sergey Senozhatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2013-01-15 11:28 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 4103 bytes --]

On (01/15/13 14:23), Sergey Senozhatsky wrote:
> On (01/15/13 19:05), Austin Zhang wrote:
> > If using '10' in this 'for' loop, for P states, once the processor
> > provides more than 10 P states, those additional ones cannot been
> > presented; and for C states, once the processor provides maximize
> > C states level more than 9, for example, it only has POLL, C1, C3,
> > C6, C10, the additional one like C10 also cannot be presented.
> >
> 
> Hm, I'm sure I've seen this before. Was it the same patch from
> you?
> 
> I recall Igor patched html report for pstate, but I also remember we had
> something about c states as well.
> 
> 	-ss
>

Ok, I found it: "Display all P-states in HTML-report"
(http://lists.01.org/pipermail/powertop/2012-July/000161.html).
There was a note from Igor
" The same issue may affect the function report_display_cpu_cstates()
but I'm not sure that CPUs with more than 10 C-states exists. "

I'll take a look at your patch, thanks.

	-ss
  
> > Now we get the loop numbers from the system information we had got
> > before.
> > 
> > Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
> > ---
> >  src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
> >  1 files changed, 29 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> > index 7f3af69..28f77b7 100644
> > --- a/src/cpu/cpu.cpp
> > +++ b/src/cpu/cpu.cpp
> > @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
> >  	unsigned int package, core, cpu;
> >  	int line;
> >  	class abstract_cpu *_package, * _core, * _cpu;
> > +	unsigned int i, j, cstates_num;
> > +
> > +	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> > +		if (all_cpus[i])
> > +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> > +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> > +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> > +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> > +	}
> >  
> >  	report.begin_section(SECTION_CPUIDLE);
> >  	report.add_header("Processor Idle state report");
> > @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
> >  			if (!_core)
> >  				continue;
> >  
> > -			for (line = LEVEL_HEADER; line < 10; line++) {
> > +			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
> >  				bool first_cpu = true;
> >  
> >  				if (!_package->has_cstate_level(line))
> > @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
> >  	char buffer[128];
> >  	char linebuf[1024];
> >  	unsigned int package, core, cpu;
> > -	int line;
> > +	int line, loop;
> >  	class abstract_cpu *_package, * _core, * _cpu;
> >  	int ctr = 0;
> > +	unsigned int i, j, cstates_num, pstates_num;
> > +
> > +	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {
> > +		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
> > +			pstates_num = all_cpus[i]->pstates.size();
> >  
> > -	if (state == PSTATE)
> > +		if (all_cpus[i])
> > +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> > +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> > +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> > +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> > +	}
> > +
> > +	if (state == PSTATE) {
> >  		win = get_ncurses_win("Frequency stats");
> > -	else
> > +		loop = (int)pstates_num;
> > +	} else {
> >  		win = get_ncurses_win("Idle stats");
> > +		loop = (int)cstates_num;
> > +	}
> >  
> >  	if (!win)
> >  		return;
> > @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
> >  			if (!_core->has_pstates() && state == PSTATE)
> >  				continue;
> >  
> > -
> > -			for (line = LEVEL_HEADER; line < 10; line++) {
> > +			for (line = LEVEL_HEADER; line <= loop; line++) {
> >  				int first = 1;
> >  				ctr = 0;
> >  				linebuf[0] = 0;
> > -- 
> > 1.7.5.4
> > 
> > _______________________________________________
> > PowerTop mailing list
> > PowerTop(a)lists.01.org
> > https://lists.01.org/mailman/listinfo/powertop
> > 

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

* Re: [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-15 11:23 Sergey Senozhatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2013-01-15 11:23 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3508 bytes --]

On (01/15/13 19:05), Austin Zhang wrote:
> If using '10' in this 'for' loop, for P states, once the processor
> provides more than 10 P states, those additional ones cannot been
> presented; and for C states, once the processor provides maximize
> C states level more than 9, for example, it only has POLL, C1, C3,
> C6, C10, the additional one like C10 also cannot be presented.
>

Hm, I'm sure I've seen this before. Was it the same patch from
you?

I recall Igor patched html report for pstate, but I also remember we had
something about c states as well.

	-ss
 
> Now we get the loop numbers from the system information we had got
> before.
> 
> Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
> ---
>  src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
>  1 files changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> index 7f3af69..28f77b7 100644
> --- a/src/cpu/cpu.cpp
> +++ b/src/cpu/cpu.cpp
> @@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
>  	unsigned int package, core, cpu;
>  	int line;
>  	class abstract_cpu *_package, * _core, * _cpu;
> +	unsigned int i, j, cstates_num;
> +
> +	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> +	}
>  
>  	report.begin_section(SECTION_CPUIDLE);
>  	report.add_header("Processor Idle state report");
> @@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
>  			if (!_core)
>  				continue;
>  
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
>  				bool first_cpu = true;
>  
>  				if (!_package->has_cstate_level(line))
> @@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
>  	char buffer[128];
>  	char linebuf[1024];
>  	unsigned int package, core, cpu;
> -	int line;
> +	int line, loop;
>  	class abstract_cpu *_package, * _core, * _cpu;
>  	int ctr = 0;
> +	unsigned int i, j, cstates_num, pstates_num;
> +
> +	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {
> +		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
> +			pstates_num = all_cpus[i]->pstates.size();
>  
> -	if (state == PSTATE)
> +		if (all_cpus[i])
> +			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
> +				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
> +				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
> +					cstates_num = (all_cpus[i]->cstates[j])->line_level;
> +	}
> +
> +	if (state == PSTATE) {
>  		win = get_ncurses_win("Frequency stats");
> -	else
> +		loop = (int)pstates_num;
> +	} else {
>  		win = get_ncurses_win("Idle stats");
> +		loop = (int)cstates_num;
> +	}
>  
>  	if (!win)
>  		return;
> @@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
>  			if (!_core->has_pstates() && state == PSTATE)
>  				continue;
>  
> -
> -			for (line = LEVEL_HEADER; line < 10; line++) {
> +			for (line = LEVEL_HEADER; line <= loop; line++) {
>  				int first = 1;
>  				ctr = 0;
>  				linebuf[0] = 0;
> -- 
> 1.7.5.4
> 
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

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

* [Powertop] [PATCH] Fix C states and P states presentation issue.
@ 2013-01-15 11:05 Austin Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Austin Zhang @ 2013-01-15 11:05 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2938 bytes --]

If using '10' in this 'for' loop, for P states, once the processor
provides more than 10 P states, those additional ones cannot been
presented; and for C states, once the processor provides maximize
C states level more than 9, for example, it only has POLL, C1, C3,
C6, C10, the additional one like C10 also cannot be presented.

Now we get the loop numbers from the system information we had got
before.

Signed-off-by: Austin Zhang <zhang.austin(a)gmail.com>
---
 src/cpu/cpu.cpp |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index 7f3af69..28f77b7 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -404,6 +404,15 @@ void report_display_cpu_cstates(void)
 	unsigned int package, core, cpu;
 	int line;
 	class abstract_cpu *_package, * _core, * _cpu;
+	unsigned int i, j, cstates_num;
+
+	for (i = 0, cstates_num = 0; i < all_cpus.size(); i++) {
+		if (all_cpus[i])
+			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
+				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
+				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
+					cstates_num = (all_cpus[i]->cstates[j])->line_level;
+	}
 
 	report.begin_section(SECTION_CPUIDLE);
 	report.add_header("Processor Idle state report");
@@ -421,7 +430,7 @@ void report_display_cpu_cstates(void)
 			if (!_core)
 				continue;
 
-			for (line = LEVEL_HEADER; line < 10; line++) {
+			for (line = LEVEL_HEADER; line <= (int)cstates_num; line++) {
 				bool first_cpu = true;
 
 				if (!_package->has_cstate_level(line))
@@ -628,14 +637,29 @@ void impl_w_display_cpu_states(int state)
 	char buffer[128];
 	char linebuf[1024];
 	unsigned int package, core, cpu;
-	int line;
+	int line, loop;
 	class abstract_cpu *_package, * _core, * _cpu;
 	int ctr = 0;
+	unsigned int i, j, cstates_num, pstates_num;
+
+	for (i = 0, cstates_num = 0, pstates_num = 0; i < all_cpus.size(); i++) {
+		if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
+			pstates_num = all_cpus[i]->pstates.size();
 
-	if (state == PSTATE)
+		if (all_cpus[i])
+			for (j = 0; j < all_cpus[i]->cstates.size(); j++)
+				if ((all_cpus[i]->cstates[j])->line_level >= 0 &&
+				    (all_cpus[i]->cstates[j])->line_level > cstates_num)
+					cstates_num = (all_cpus[i]->cstates[j])->line_level;
+	}
+
+	if (state == PSTATE) {
 		win = get_ncurses_win("Frequency stats");
-	else
+		loop = (int)pstates_num;
+	} else {
 		win = get_ncurses_win("Idle stats");
+		loop = (int)cstates_num;
+	}
 
 	if (!win)
 		return;
@@ -656,8 +680,7 @@ void impl_w_display_cpu_states(int state)
 			if (!_core->has_pstates() && state == PSTATE)
 				continue;
 
-
-			for (line = LEVEL_HEADER; line < 10; line++) {
+			for (line = LEVEL_HEADER; line <= loop; line++) {
 				int first = 1;
 				ctr = 0;
 				linebuf[0] = 0;
-- 
1.7.5.4


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

end of thread, other threads:[~2013-01-22 11:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-22 11:45 [Powertop] [PATCH] Fix C states and P states presentation issue Austin Zhang
  -- strict thread matches above, loose matches on Subject: below --
2013-01-22  8:19 Sergey Senozhatsky
2013-01-21 12:35 Sergey Senozhatsky
2013-01-21 12:31 Sergey Senozhatsky
2013-01-15 11:28 Sergey Senozhatsky
2013-01-15 11:23 Sergey Senozhatsky
2013-01-15 11:05 Austin Zhang

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.