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
diff -up powertop-1.11/cpufreqstats.c.old powertop-1.11/cpufreqstats.c
--- powertop-1.11/cpufreqstats.c.old	2010-11-30 10:46:01.000000000 +0100
+++ powertop-1.11/cpufreqstats.c	2010-11-30 10:29:16.944794124 +0100
@@ -42,8 +42,9 @@ struct cpufreqdata oldfreqs[16];
 
 struct cpufreqdata delta[16];
 
-char cpufreqstrings[6][80];
+char cpufreqstrings[17][80];
 int topfreq = -1;
+int maxfreq = 0;
 
 static void zap(void)
 {
@@ -107,9 +108,9 @@ 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));
 	sprintf(cpufreqstrings[0], _("P-states (frequencies)\n"));
@@ -173,9 +174,11 @@ 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;
+	}
 	qsort(&delta, maxfreq+1, sizeof(struct cpufreqdata), sort_by_freq);
 
 	if (delta[0].frequency == delta[1].frequency + 1000)
diff -up powertop-1.11/display.c.old powertop-1.11/display.c
--- powertop-1.11/display.c.old	2010-11-30 10:45:56.000000000 +0100
+++ powertop-1.11/display.c	2010-11-30 10:51:55.435793964 +0100
@@ -177,7 +177,7 @@ void show_cstates(void) 
 		}
 	}
 
-	for (i=0; i<6; i++) {
+	for (i=0; i<(dump?maxfreq+2:6); i++) {
 		if (i == topfreq+1)
 			wattron(cstate_window, A_BOLD);
 		else
diff -up powertop-1.11/powertop.h.old powertop-1.11/powertop.h
--- powertop-1.11/powertop.h.old	2010-11-30 10:45:56.000000000 +0100
+++ powertop-1.11/powertop.h	2010-11-30 10:27:58.701793997 +0100
@@ -65,11 +65,12 @@ void usb_activity_hint(void);
 
 
 extern char cstate_lines[12][200];
-extern char cpufreqstrings[6][80];
+extern char cpufreqstrings[17][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

Reply via email to