aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2010-12-19 16:20:06 -0800
committerArjan van de Ven <arjan@linux.intel.com>2010-12-19 16:20:06 -0800
commit40935ac99a4b3274ab8bc7b0f108b93728e0cf43 (patch)
tree24586827970a336543e893a775aabd3a647143dd
parentd0933bec54c9f2e4a8c6ab6aec25b2d691d276e0 (diff)
downloadpowertop-40935ac99a4b3274ab8bc7b0f108b93728e0cf43.tar.gz
show tunables as well in the html output
-rw-r--r--main.cpp1
-rw-r--r--powertop.css22
-rw-r--r--tuning/runtime.cpp16
-rw-r--r--tuning/tunable.cpp1
-rw-r--r--tuning/tunable.h3
-rw-r--r--tuning/tuning.cpp88
-rw-r--r--tuning/tuning.h2
7 files changed, 129 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 901dcf4..9aff81b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -181,6 +181,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Measuring for 20 seconds\n");
one_measurement(1);
initialize_tuning();
+ html_show_tunables();
finish_html_output();
diff --git a/powertop.css b/powertop.css
index 3136023..e7b7f27 100644
--- a/powertop.css
+++ b/powertop.css
@@ -122,3 +122,25 @@ td.device_util
}
}
+
+tr.tunable_odd
+{
+ background-color: #E0E0E0;
+ color: black;
+}
+tr.tunable_even
+{
+ background-color: #F0f0F0;
+ color: black;
+}
+
+tr.tunable_odd_bad
+{
+ background-color: #FFE0E0;
+ color: black;
+}
+tr.tunable_even_bad
+{
+ background-color: #FFf0F0;
+ color: black;
+}
diff --git a/tuning/runtime.cpp b/tuning/runtime.cpp
index 3f8cd6f..0eb3531 100644
--- a/tuning/runtime.cpp
+++ b/tuning/runtime.cpp
@@ -45,6 +45,8 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *
sprintf(desc, "Runtime PM for %s device %s", bus, dev);
+ if (!device_has_runtime_pm(path))
+ sprintf(desc, "%s device %s has no runtime power management", bus, dev);
if (strcmp(bus, "pci") == 0) {
char filename[4096];
@@ -67,8 +69,13 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *
}
if (vendor && device) {
- sprintf(desc, "Runtime PM for PCI Device %s", pci_id_to_name(vendor, device, filename, 4095));
+ if (!device_has_runtime_pm(path))
+ sprintf(desc, "PCI Device %s has no runtime power management", pci_id_to_name(vendor, device, filename, 4095));
+ else
+ sprintf(desc, "Runtime PM for PCI Device %s", pci_id_to_name(vendor, device, filename, 4095));
}
+
+
}
}
@@ -122,8 +129,6 @@ void add_runtime_tunables(const char *bus)
sprintf(filename, "/sys/bus/%s/devices/%s", bus, entry->d_name);
- if (!device_has_runtime_pm(filename))
- continue;
sprintf(filename, "/sys/bus/%s/devices/%s/power/control", bus, entry->d_name);
@@ -136,7 +141,10 @@ void add_runtime_tunables(const char *bus)
runtime = new class runtime_tunable(filename, bus, entry->d_name);
- all_tunables.push_back(runtime);
+ if (!device_has_runtime_pm(filename))
+ all_untunables.push_back(runtime);
+ else
+ all_tunables.push_back(runtime);
}
closedir(dir);
diff --git a/tuning/tunable.cpp b/tuning/tunable.cpp
index c4ebf57..612e458 100644
--- a/tuning/tunable.cpp
+++ b/tuning/tunable.cpp
@@ -28,6 +28,7 @@
#include <string.h>
vector<class tunable *> all_tunables;
+vector<class tunable *> all_untunables;
tunable::tunable(const char *str, double _score, const char *good, const char *bad, const char *neutral)
diff --git a/tuning/tunable.h b/tuning/tunable.h
index 09c27f1..4d3e0f2 100644
--- a/tuning/tunable.h
+++ b/tuning/tunable.h
@@ -31,6 +31,7 @@ using namespace std;
#define TUNE_GOOD 1
#define TUNE_BAD -1
+#define TUNE_UNFIXABLE -2
#define TUNE_UNKNOWN 0
#define TUNE_NEUTRAL 0
@@ -54,6 +55,7 @@ public:
case TUNE_GOOD:
return good_string;
case TUNE_BAD:
+ case TUNE_UNFIXABLE:
return bad_string;
}
return neutral_string;
@@ -66,5 +68,6 @@ public:
};
extern vector<class tunable *> all_tunables;
+extern vector<class tunable *> all_untunables;
#endif
diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp
index e31b96e..201ec0a 100644
--- a/tuning/tuning.cpp
+++ b/tuning/tuning.cpp
@@ -35,6 +35,7 @@
#include "usb.h"
#include "runtime.h"
#include "../display.h"
+#include "../html.h"
static void sort_tunables(void);
@@ -162,3 +163,90 @@ void tuning_window::expose(void)
sort_tunables();
repaint();
}
+
+static const char *tune_class(int line)
+{
+ if (line & 1) {
+ return "tunable_odd";
+ }
+ return "tunable_even";
+}
+
+static const char *tune_class_bad(int line)
+{
+ if (line & 1) {
+ return "tunable_odd_bad";
+ }
+ return "tunable_even_bad";
+}
+
+
+void html_show_tunables(void)
+{
+ unsigned int i, line;
+ /* three sections; bad, unfixable, good */
+
+ if (!htmlout)
+ return;
+
+ sort_tunables();
+
+ line = 0;
+ for (i = 0; i < all_tunables.size(); i++) {
+ int gb;
+
+ gb = all_tunables[i]->good_bad();
+
+ if (gb != TUNE_BAD)
+ continue;
+
+ if (line == 0) {
+ fprintf(htmlout, "<h2>Software settings in need of tuning</h2>\n");
+ fprintf(htmlout, "<p><table width=100%%>\n");
+ }
+
+ line++;
+ fprintf(htmlout, "<tr class=\"%s\"><td>%s</td></tr>\n", tune_class_bad(line), all_tunables[i]->description());
+ }
+
+ if (line > 0)
+ fprintf(htmlout, "</table></p>\n");
+
+
+ line = 0;
+ for (i = 0; i < all_untunables.size(); i++) {
+ if (line == 0) {
+ fprintf(htmlout, "<h2>Untunable software issues</h2>\n");
+ fprintf(htmlout, "<p><table width=100%%>\n");
+ }
+
+ line++;
+ fprintf(htmlout, "<tr class=\"%s\"><td>%s</td></tr>\n", tune_class_bad(line), all_untunables[i]->description());
+ }
+
+ if (line > 0)
+ fprintf(htmlout, "</table></p>\n");
+
+
+ line = 0;
+ for (i = 0; i < all_tunables.size(); i++) {
+ int gb;
+
+ gb = all_tunables[i]->good_bad();
+
+ if (gb != TUNE_GOOD)
+ continue;
+
+ if (line == 0) {
+ fprintf(htmlout, "<h2>Optimal tuned software settings</h2>\n");
+ fprintf(htmlout, "<p><table width=100%%>\n");
+ }
+
+ line++;
+ fprintf(htmlout, "<tr class=\"%s\"><td>%s</td></tr>\n", tune_class(line), all_tunables[i]->description());
+ }
+
+ if (line > 0)
+ fprintf(htmlout, "</table></p>\n");
+
+}
diff --git a/tuning/tuning.h b/tuning/tuning.h
index 9469cf9..e3e9d5c 100644
--- a/tuning/tuning.h
+++ b/tuning/tuning.h
@@ -27,6 +27,8 @@
extern void initialize_tuning(void);
extern void tuning_update_display(void);
+extern void html_show_tunables(void);
+
#endif