From d449850aad481cb9928fe6a9947b2bb536f89ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Thu, 16 Aug 2012 13:37:51 +0200 Subject: [PATCH] New version - Removed patches (all upstreamed): show-watts-only-if-discharging, valid-html-output, factor-out-powertop-init, catch-fstream-errors --- .gitignore | 1 + powertop-2.0-catch-fstream-errors.patch | 98 --- powertop-2.0-factor-out-powertop-init.patch | 199 ------ ...p-2.0-show-watts-only-if-discharging.patch | 12 - powertop-2.0-valid-html-output.patch | 640 ------------------ powertop.spec | 29 +- sources | 2 +- 7 files changed, 12 insertions(+), 969 deletions(-) delete mode 100644 powertop-2.0-catch-fstream-errors.patch delete mode 100644 powertop-2.0-factor-out-powertop-init.patch delete mode 100644 powertop-2.0-show-watts-only-if-discharging.patch delete mode 100644 powertop-2.0-valid-html-output.patch diff --git a/.gitignore b/.gitignore index 2d01509..a25a40f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ powertop-*.tar.bz2 +/powertop-2.1.tar.gz diff --git a/powertop-2.0-catch-fstream-errors.patch b/powertop-2.0-catch-fstream-errors.patch deleted file mode 100644 index f56600f..0000000 --- a/powertop-2.0-catch-fstream-errors.patch +++ /dev/null @@ -1,98 +0,0 @@ -commit e3a0dce60a1ff1663dab0f91cc4dacf89b565dea -Author: Sergey Senozhatsky -Date: Fri May 18 13:17:39 2012 +0300 - - catch fstream exceptions in lib routines - - Catch possible fstream and traits_type exceptions in lib. - - Reported-by: Lekensteyn - Signed-off-by: Sergey Senozhatsky - -diff --git a/src/lib.cpp b/src/lib.cpp -index 53638dd..bcd809f 100644 ---- a/src/lib.cpp -+++ b/src/lib.cpp -@@ -172,8 +172,13 @@ void write_sysfs(const string &filename, const string &value) - file.open(filename.c_str(), ios::out); - if (!file) - return; -- file << value; -- file.close(); -+ try -+ { -+ file << value; -+ file.close(); -+ } catch (std::exception &exc) { -+ return; -+ } - } - - int read_sysfs(const string &filename, bool *ok) -@@ -187,10 +192,17 @@ int read_sysfs(const string &filename, bool *ok) - *ok = false; - return 0; - } -- file >> i; -+ try -+ { -+ file >> i; -+ if (ok) -+ *ok = true; -+ } catch (std::exception &exc) { -+ if (ok) -+ *ok = "false"; -+ i = 0; -+ } - file.close(); -- if (ok) -- *ok = true; - return i; - } - -@@ -203,11 +215,17 @@ string read_sysfs_string(const string &filename) - file.open(filename.c_str(), ios::in); - if (!file) - return ""; -- file.getline(content, 4096); -- file.close(); -- c = strchr(content, '\n'); -- if (c) -- *c = 0; -+ try -+ { -+ file.getline(content, 4096); -+ file.close(); -+ c = strchr(content, '\n'); -+ if (c) -+ *c = 0; -+ } catch (std::exception &exc) { -+ file.close(); -+ return ""; -+ } - return content; - } - -@@ -224,11 +242,17 @@ string read_sysfs_string(const char *format, const char *param) - file.open(filename, ios::in); - if (!file) - return ""; -- file.getline(content, 4096); -- file.close(); -- c = strchr(content, '\n'); -- if (c) -- *c = 0; -+ try -+ { -+ file.getline(content, 4096); -+ file.close(); -+ c = strchr(content, '\n'); -+ if (c) -+ *c = 0; -+ } catch (std::exception &exc) { -+ file.close(); -+ return ""; -+ } - return content; - } - diff --git a/powertop-2.0-factor-out-powertop-init.patch b/powertop-2.0-factor-out-powertop-init.patch deleted file mode 100644 index ad8934e..0000000 --- a/powertop-2.0-factor-out-powertop-init.patch +++ /dev/null @@ -1,199 +0,0 @@ -From f121fe4d1eb444b1026cd936d839a877fd177727 Mon Sep 17 00:00:00 2001 -From: Sergey Senozhatsky -Date: Thu, 17 May 2012 19:44:58 +0300 -Subject: [PATCH] factor out powertop_init() function - -Factor out powertop_init() function to perform basic initialization on -powertop start up. - -Commit 057d6126eb6329c86b29a2e0219c0d0e49a84191 moved init after -commandline options parsing. However, in some cases we need it before -parsing, e.g. -- calibration. - -Reported-by: Lekensteyn -Signed-off-by: Sergey Senozhatsky ---- - src/main.cpp | 110 ++++++++++++++++++++++++++++++--------------------------- - 1 files changed, 58 insertions(+), 52 deletions(-) - -diff --git a/src/main.cpp b/src/main.cpp -index 433fea6..b5720f0 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -280,15 +280,68 @@ static void checkroot() { - } - - } --int main(int argc, char **argv) -+ -+static void powertop_init(void) - { -+ static char initialized = 0; - int ret; -+ struct statfs st_fs; -+ -+ if (initialized) -+ return; -+ -+ checkroot(); -+ ret = system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1"); -+ ret = system("/sbin/modprobe msr > /dev/null 2>&1"); -+ statfs("/sys/kernel/debug", &st_fs); -+ -+ if (st_fs.f_type != (long) DEBUGFS_MAGIC) { -+ if (access("/bin/mount", X_OK) == 0) { -+ ret = system("/bin/mount -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1"); -+ } else { -+ ret = system("mount -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1"); -+ } -+ if (ret != 0) { -+ printf(_("Failed to mount debugfs!\n")); -+ printf(_("exiting...\n")); -+ exit(EXIT_FAILURE); -+ } -+ } -+ -+ srand(time(NULL)); -+ -+ if (access("/var/cache/", W_OK) == 0) -+ mkdir("/var/cache/powertop", 0600); -+ else -+ mkdir("/data/local/powertop", 0600); -+ -+ load_results("saved_results.powertop"); -+ load_parameters("saved_parameters.powertop"); -+ -+ enumerate_cpus(); -+ create_all_devices(); -+ detect_power_meters(); -+ -+ register_parameter("base power", 100, 0.5); -+ register_parameter("cpu-wakeups", 39.5); -+ register_parameter("cpu-consumption", 1.56); -+ register_parameter("gpu-operations", 0.5576); -+ register_parameter("disk-operations-hard", 0.2); -+ register_parameter("disk-operations", 0.0); -+ register_parameter("xwakes", 0.1); -+ -+ load_board_params(); -+ initialized = 1; -+} -+ -+ -+int main(int argc, char **argv) -+{ - int option_index; - int c; - bool wantreport = FALSE; - char filename[4096]; - int iterations = 1; -- struct statfs st_fs; - - #ifndef DISABLE_TRYCATCH - set_new_handler(out_of_memory); -@@ -322,6 +375,7 @@ int main(int argc, char **argv) - break; - - case 'c': -+ powertop_init(); - calibrate(); - break; - -@@ -350,48 +404,8 @@ int main(int argc, char **argv) - break; - } - } -- -- checkroot(); -- ret = system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1"); -- ret = system("/sbin/modprobe msr > /dev/null 2>&1"); -- -- statfs("/sys/kernel/debug", &st_fs); -- if (st_fs.f_type != (long) DEBUGFS_MAGIC) { -- if (access("/bin/mount", X_OK) == 0) { -- ret = system("/bin/mount -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1"); -- } else { -- ret = system("mount -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1"); -- } -- if (ret != 0) { -- printf(_("Failed to mount debugfs!\n")); -- printf(_("exiting...\n")); -- exit(EXIT_FAILURE); -- } -- } -- -- srand(time(NULL)); -- -- if (access("/var/cache/", W_OK) == 0) -- mkdir("/var/cache/powertop", 0600); -- else -- mkdir("/data/local/powertop", 0600); - -- load_results("saved_results.powertop"); -- load_parameters("saved_parameters.powertop"); -- -- enumerate_cpus(); -- create_all_devices(); -- detect_power_meters(); -- -- register_parameter("base power", 100, 0.5); -- register_parameter("cpu-wakeups", 39.5); -- register_parameter("cpu-consumption", 1.56); -- register_parameter("gpu-operations", 0.5576); -- register_parameter("disk-operations-hard", 0.2); -- register_parameter("disk-operations", 0.0); -- register_parameter("xwakes", 0.1); -- -- load_board_params(); -+ powertop_init(); - - if (wantreport) - report(time_out, iterations, filename); -@@ -399,8 +413,6 @@ int main(int argc, char **argv) - if (debug_learning) - printf("Learning debugging enabled\n"); - -- -- - learn_parameters(250, 0); - save_parameters("saved_parameters.powertop"); - -@@ -412,7 +424,6 @@ int main(int argc, char **argv) - exit(0); - } - -- - /* first one is short to not let the user wait too long */ - init_display(); - one_measurement(1); -@@ -420,11 +431,9 @@ int main(int argc, char **argv) - tuning_update_display(); - show_tab(0); - -- -- - while (!leave_powertop) { -- one_measurement(time_out); - show_cur_tab(); -+ one_measurement(time_out); - learn_parameters(15, 0); - } - #ifndef DISABLE_NCURSES -@@ -432,7 +441,6 @@ int main(int argc, char **argv) - #endif - printf(_("Leaving PowerTOP\n")); - -- - end_process_data(); - clear_process_data(); - end_cpu_data(); -@@ -450,6 +458,4 @@ int main(int argc, char **argv) - clear_all_cpus(); - - return 0; -- -- - } --- -1.7.7.6 - diff --git a/powertop-2.0-show-watts-only-if-discharging.patch b/powertop-2.0-show-watts-only-if-discharging.patch deleted file mode 100644 index 748a325..0000000 --- a/powertop-2.0-show-watts-only-if-discharging.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up powertop-2.0/src/measurement/measurement.cpp.orig powertop-2.0/src/measurement/measurement.cpp ---- powertop-2.0/src/measurement/measurement.cpp.orig 2012-04-17 15:47:59.000000000 +0200 -+++ powertop-2.0/src/measurement/measurement.cpp 2012-04-17 15:49:31.690862740 +0200 -@@ -130,7 +130,7 @@ void power_supply_callback(const char *d - while (file) { - file.getline(line, 4096); - -- if (strstr(line, "POWER_SUPPLY_STATUS") && strstr(line, "POWER_SUPPLY_STATUS")) -+ if (strstr(line, "POWER_SUPPLY_STATUS") && strstr(line, "Discharging")) - discharging = true; - } - file.close(); diff --git a/powertop-2.0-valid-html-output.patch b/powertop-2.0-valid-html-output.patch deleted file mode 100644 index 6333b12..0000000 --- a/powertop-2.0-valid-html-output.patch +++ /dev/null @@ -1,640 +0,0 @@ -From dca19ed0aa83e558f050b28620262bcd0af9b55c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= -Date: Wed, 16 May 2012 16:36:54 +0200 -Subject: [PATCH] Fixed HTML output to make W3C validator happy - -Various fixes to pass W3C HTML validation. Also unified -whitespaces - preferred tabs over multiple spaces to save -some space. ---- - src/powertop.css | 481 ++++++++++++++++++++++---------------------- - src/process/do_process.cpp | 2 +- - src/report.cpp | 2 +- - 3 files changed, 243 insertions(+), 242 deletions(-) - -diff --git a/src/powertop.css b/src/powertop.css -index 4a67c7f..087e384 100644 ---- a/src/powertop.css -+++ b/src/powertop.css -@@ -1,52 +1,55 @@ -- -+ - -+ -+PowerTOP report -+ - -- -- -