From e06f2c78392ec08913c6ac7c4d0fc24fedea3a5b Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 22 Jan 2008 15:29:03 +0000 Subject: powertop: fix crash in dump mode git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3572 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- meta/packages/powertop/files/dump-fixes.patch | 107 ++++++++++++++++++++++++++ meta/packages/powertop/powertop_1.9.bb | 5 +- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 meta/packages/powertop/files/dump-fixes.patch (limited to 'meta/packages') diff --git a/meta/packages/powertop/files/dump-fixes.patch b/meta/packages/powertop/files/dump-fixes.patch new file mode 100644 index 000000000..7f6af7dd1 --- /dev/null +++ b/meta/packages/powertop/files/dump-fixes.patch @@ -0,0 +1,107 @@ +=== modified file 'display.c' +--- powertop-1.9/display.c 2008-01-22 14:35:03 +0000 ++++ powertop-1.9/display.c 2008-01-22 14:42:30 +0000 +@@ -182,7 +182,8 @@ + print(cstate_window, i, 38, "%s", cpufreqstrings[i]); + } + +- wrefresh(cstate_window); ++ if (!dump) ++ wrefresh(cstate_window); + } + + +@@ -192,7 +193,7 @@ + + sprintf(buffer, _("no ACPI power usage estimate available") ); + +- werase(acpi_power_window); ++ if (!dump) werase(acpi_power_window); + if (rate > 0.001) { + char *c; + sprintf(buffer, _("Power usage (ACPI estimate): %3.1fW (%3.1f hours)"), rate, cap/rate); +@@ -205,45 +206,51 @@ + sprintf(buffer, _("Power usage (5 minute ACPI estimate) : %5.1f W (%3.1f hours left)"), 3600*capdelta / ti, cap / (3600*capdelta/ti+0.01)); + + print(acpi_power_window, 0, 0, "%s\n", buffer); +- wrefresh(acpi_power_window); ++ if (!dump) wrefresh(acpi_power_window); + } + + void show_wakeups(double d, double interval, double C0time) + { +- werase(wakeup_window); +- +- wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_RED)); +- if (d <= 25.0) +- wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_YELLOW)); +- if (d <= 10.0) +- wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_GREEN)); +- +- /* +- * if the cpu is really busy.... then make it blue to indicate +- * that it's not the primary power consumer anymore +- */ +- if (C0time > 25.0) +- wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_BLUE)); +- +- wattron(wakeup_window, A_BOLD); ++ if (!dump) { ++ werase(wakeup_window); ++ ++ wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_RED)); ++ if (d <= 25.0) ++ wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_YELLOW)); ++ if (d <= 10.0) ++ wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_GREEN)); ++ ++ /* ++ * if the cpu is really busy.... then make it blue to indicate ++ * that it's not the primary power consumer anymore ++ */ ++ if (C0time > 25.0) ++ wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_BLUE)); ++ ++ wattron(wakeup_window, A_BOLD); ++ } ++ + print(wakeup_window, 0, 0, _("Wakeups-from-idle per second : %4.1f\tinterval: %0.1fs\n"), d, interval); +- wrefresh(wakeup_window); ++ ++ if (!dump) wrefresh(wakeup_window); + } + + void show_timerstats(int nostats, int ticktime) + { + int i; +- werase(timerstat_window); ++ if (!dump) werase(timerstat_window); + + if (!nostats) { + int counter = 0; + print(timerstat_window, 0, 0, _("Top causes for wakeups:\n")); + for (i = 0; i < linehead; i++) + if (lines[i].count > 0 && counter++ < maxtimerstats) { +- if ((lines[i].count * 1.0 / ticktime) >= 10.0) +- wattron(timerstat_window, A_BOLD); +- else +- wattroff(timerstat_window, A_BOLD); ++ if (!dump) { ++ if ((lines[i].count * 1.0 / ticktime) >= 10.0) ++ wattron(timerstat_window, A_BOLD); ++ else ++ wattroff(timerstat_window, A_BOLD); ++ } + print(timerstat_window, i+1, 0," %5.1f%% (%5.1f) %s \n", lines[i].count * 100.0 / linectotal, + lines[i].count * 1.0 / ticktime, + lines[i].string); +@@ -259,7 +266,7 @@ + } + + +- wrefresh(timerstat_window); ++ if (!dump) wrefresh(timerstat_window); + } + + void show_suggestion(char *sug) + diff --git a/meta/packages/powertop/powertop_1.9.bb b/meta/packages/powertop/powertop_1.9.bb index ab84161dd..f78714c71 100644 --- a/meta/packages/powertop/powertop_1.9.bb +++ b/meta/packages/powertop/powertop_1.9.bb @@ -3,7 +3,10 @@ HOMEPAGE = "http://www.linuxpowertop.org/" LICENSE = "GPLv2" DEPENDS = "ncurses" -SRC_URI = "http://www.linuxpowertop.org/download/powertop-${PV}.tar.gz" +PR="r1" + +SRC_URI = "http://www.linuxpowertop.org/download/powertop-${PV}.tar.gz \ + file://dump-fixes.patch;patch=1" CFLAGS += "${LDFLAGS}" -- cgit v1.2.3