On 11/30/10 07:25, Jaroslav Skarvada wrote:
> I think it would be useful to list all P-states in dump mode. Not
> only you would be able to easily overview which P-states are
> available in your system, but also you would get consistent
> information if there is turbo available. Now with powertop -d, if
> there are a lot of P-states and the Turbo state usage is low, it can
> easily fall off the list. I attached simple patch that should resolve
> this
>
> Jaroslav
I took your patch and fixed it up quite a bit to accomodate for some
other changes that went into git. Can you pull the latest git, apply
below modified patch and give this a test and see if it does what you
want it to?
Auke
----
diff --git a/cpufreqstats.c b/cpufreqstats.c
index 6e948cd..b4a6462 100644
--- a/cpufreqstats.c
+++ b/cpufreqstats.c
@@ -44,6 +44,7 @@ struct cpufreqdata delta[MAX_NUM_PSTATES];
char cpufreqstrings[MAX_NUM_PSTATES+1][80];
int topfreq = -1;
+int maxfreq = 0;
static void zap(void)
{
@@ -107,9 +108,10 @@ void do_cpufreq_stats(void)
char line[1024];
int ret = 0;
- int maxfreq = 0;
uint64_t total_time = 0;
+ maxfreq = 0;
+
memcpy(&oldfreqs, &freqs, sizeof(freqs));
memset(&cpufreqstrings, 0, sizeof(cpufreqstrings));
memset(&cpufreqstrings, 0, sizeof(cpufreqstrings));
sprintf(cpufreqstrings[0], _("P-states (frequencies)\n"));
@@ -173,9 +175,12 @@ void do_cpufreq_stats(void)
if (!total_time)
return;
- qsort(&delta, maxfreq+1, sizeof(struct cpufreqdata), sort_by_count);
- if (maxfreq>4)
- maxfreq=4;
+ if (!dump) {
+ qsort(&delta, maxfreq+1, sizeof(struct cpufreqdata),
+ sort_by_count);
+ if (maxfreq>4)
+ maxfreq=4;
+ }
maxpstate = maxfreq;
qsort(&delta, maxfreq+1, sizeof(struct cpufreqdata), sort_by_freq);
diff --git a/display.c b/display.c
index 6682d34..a5bd960 100644
--- a/display.c
+++ b/display.c
@@ -185,7 +185,7 @@ void show_c_and_p_states(void)
p_werase(cstate_window);
- for (i = 0; i < maxcstatelines; i++) {
+ for (i = 0; i < (dump ? MAX_CSTATE_LINES + 1 : maxcstatelines);
i++) {
if (i == topcstate+1)
p_wattron(cstate_window, A_BOLD);
else
@@ -196,7 +196,7 @@ void show_c_and_p_states(void)
}
}
- for (i = 0; i <= (maxpstate+1); i++) {
+ for (i = 0; i < (dump ? MAX_NUM_PSTATES + 1 : maxfreq + 1); i++) {
if (i == topfreq+1)
p_wattron(cstate_window, A_BOLD);
else
diff --git a/powertop.h b/powertop.h
index 22814d5..85f286c 100644
--- a/powertop.h
+++ b/powertop.h
@@ -88,6 +88,7 @@ extern char cpufreqstrings[MAX_NUM_PSTATES+1][80];
extern int topcstate;
extern int topfreq;
extern int dump;
+extern int maxfreq;
extern int showpids;
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power