diff --git a/.cvsignore b/.cvsignore index cc6b9cd..db6a2cb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -powertop-1.7.tar.gz +powertop-1.8.tar.gz diff --git a/powertop-1.7-dump.patch b/powertop-1.7-dump.patch deleted file mode 100644 index 6e61881..0000000 --- a/powertop-1.7-dump.patch +++ /dev/null @@ -1,285 +0,0 @@ -diff -ru powertop-1.7/cpufreqstats.c powertop-1.7-new/cpufreqstats.c ---- powertop-1.7/cpufreqstats.c 2007-06-17 12:05:10.000000000 -0400 -+++ powertop-1.7-new/cpufreqstats.c 2007-06-28 16:38:30.000000000 -0400 -@@ -42,7 +42,7 @@ - - struct cpufreqdata delta[16]; - --char cpufreqstrings[4][80]; -+char cpufreqstrings[5][80]; - int topfreq = -1; - - static void zap(void) -@@ -98,6 +98,7 @@ - - memcpy(&oldfreqs, &freqs, sizeof(freqs)); - memset(&cpufreqstrings, 0, sizeof(cpufreqstrings)); -+ sprintf(cpufreqstrings[0], _("P-states (frequencies)\n")); - - for (ret = 0; ret<16; ret++) - freqs[ret].count = 0; -@@ -164,8 +165,8 @@ - qsort(&delta, maxfreq+1, sizeof(struct cpufreqdata), sort_by_freq); - - topfreq = -1; -- for (ret =0 ; ret<=maxfreq; ret++) { -- sprintf(cpufreqstrings[ret], "%6s %5.1f%%", HzToHuman(delta[ret].frequency), delta[ret].count * 100.0 / total_time); -+ for (ret = 0 ; ret<=maxfreq; ret++) { -+ sprintf(cpufreqstrings[ret+1], "%6s %5.1f%%\n", HzToHuman(delta[ret].frequency), delta[ret].count * 100.0 / total_time); - if (delta[ret].count > total_time/2) - topfreq = ret; - } -diff -ru powertop-1.7/display.c powertop-1.7-new/display.c ---- powertop-1.7/display.c 2007-06-17 21:16:33.000000000 -0400 -+++ powertop-1.7-new/display.c 2007-06-28 16:38:30.000000000 -0400 -@@ -43,6 +43,7 @@ - static WINDOW *suggestion_window; - static WINDOW *status_bar_window; - -+#define print(win, y, x, fmt, args...) do { if (dump) printf(fmt, ## args); else mvwprintw(win, y, x, fmt, ## args); } while (0) - - char status_bar_slots[10][40]; - -@@ -85,8 +86,8 @@ - - int maxx, maxy; - --int maxtimerstats; --int maxwidth; -+int maxtimerstats = 50; -+int maxwidth = 200; - - void setup_windows(void) - { -@@ -141,7 +142,7 @@ - wbkgd(title_bar_window, COLOR_PAIR(PT_COLOR_HEADER_BAR)); - werase(title_bar_window); - -- mvwprintw(title_bar_window, 0, 0, " PowerTOP version 1.7 (C) 2007 Intel Corporation"); -+ print(title_bar_window, 0, 0, " PowerTOP version 1.7 (C) 2007 Intel Corporation"); - - wrefresh(title_bar_window); - -@@ -152,7 +153,7 @@ - if (strlen(status_bar_slots[i])==0) - continue; - wattron(status_bar_window, A_REVERSE); -- mvwprintw(status_bar_window, 0, x, status_bar_slots[i]); -+ print(status_bar_window, 0, x, status_bar_slots[i]); - wattroff(status_bar_window, A_REVERSE); - x+= strlen(status_bar_slots[i])+1; - } -@@ -169,15 +170,15 @@ - wattron(cstate_window, A_BOLD); - else - wattroff(cstate_window, A_BOLD); -- mvwprintw(cstate_window, i, 0, "%s", cstate_lines[i]); -+ print(cstate_window, i, 0, "%s", cstate_lines[i]); - } - -- for (i=0; i<4; i++) { -+ for (i=0; i<5; i++) { - if (i == topfreq) - wattron(cstate_window, A_BOLD); - else - wattroff(cstate_window, A_BOLD); -- mvwprintw(cstate_window, i+2, 38, "%s", cpufreqstrings[i]); -+ print(cstate_window, i, 38, "%s", cpufreqstrings[i]); - } - - wrefresh(cstate_window); -@@ -202,7 +203,7 @@ - else if (ti>120 && capdelta > 0.001) - sprintf(buffer, _("Power usage (5 minute ACPI estimate) : %5.1f W (%3.1f hours left)"), 3600*capdelta / ti, cap / (3600*capdelta/ti+0.01)); - -- mvwprintw(acpi_power_window, 0, 0, buffer); -+ print(acpi_power_window, 0, 0, "%s\n", buffer); - wrefresh(acpi_power_window); - } - -@@ -217,7 +218,7 @@ - wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_GREEN)); - - wattron(wakeup_window, A_BOLD); -- mvwprintw(wakeup_window, 0, 0, _("Wakeups-from-idle per second : %4.1f"), d); -+ print(wakeup_window, 0, 0, _("Wakeups-from-idle per second : %4.1f\n"), d); - wrefresh(wakeup_window); - } - -@@ -228,25 +229,25 @@ - - if (!nostats) { - int counter = 0; -- mvwprintw(timerstat_window, 0, 0, _("Top causes for wakeups:")); -+ 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); -- mvwprintw(timerstat_window, i+1, 0," %5.1f%% (%5.1f) %s ", lines[i].count * 100.0 / linectotal, -+ 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); - } - } else { - if (getuid() == 0) { -- mvwprintw(timerstat_window, 0, 0, _("No detailed statistics available; please enable the CONFIG_TIMER_STATS kernel option\n")); -- mvwprintw(timerstat_window, 1, 0, _("This option is located in the Kernel Debugging section of menuconfig\n")); -- mvwprintw(timerstat_window, 2, 0, _("(which is CONFIG_DEBUG_KERNEL=y in the config file)\n")); -- mvwprintw(timerstat_window, 3, 0, _("Note: this is only available in 2.6.21 and later kernels\n")); -+ print(timerstat_window, 0, 0, _("No detailed statistics available; please enable the CONFIG_TIMER_STATS kernel option\n")); -+ print(timerstat_window, 1, 0, _("This option is located in the Kernel Debugging section of menuconfig\n")); -+ print(timerstat_window, 2, 0, _("(which is CONFIG_DEBUG_KERNEL=y in the config file)\n")); -+ print(timerstat_window, 3, 0, _("Note: this is only available in 2.6.21 and later kernels\n")); - } else -- mvwprintw(timerstat_window, 0, 0, _("No detailed statistics available; PowerTOP needs root privileges for that\n")); -+ print(timerstat_window, 0, 0, _("No detailed statistics available; PowerTOP needs root privileges for that\n")); - } - - -@@ -256,6 +257,6 @@ - void show_suggestion(char *sug) - { - werase(suggestion_window); -- mvwprintw(suggestion_window, 0, 0, "%s", sug); -+ print(suggestion_window, 0, 0, "%s", sug); - wrefresh(suggestion_window); - } -diff -ru powertop-1.7/powertop.c powertop-1.7-new/powertop.c ---- powertop-1.7/powertop.c 2007-06-17 21:16:31.000000000 -0400 -+++ powertop-1.7-new/powertop.c 2007-06-28 16:44:19.000000000 -0400 -@@ -22,6 +22,7 @@ - * Arjan van de Ven - */ - -+#include - #include - #include - #include -@@ -48,6 +49,8 @@ - static int maxcstate = 0; - int topcstate = 0; - -+int dump = 0; -+ - #define IRQCOUNT 100 - - struct irqdata { -@@ -372,6 +375,15 @@ - - char cstate_lines[6][200]; - -+void usage() -+{ -+ printf(_("Usage: powertop [OPTION...]\n")); -+ printf(_(" -d, --dump read wakeups once and print list of top offenders\n")); -+ printf(_(" -t, --time=DOUBLE default time to gather data in seconds\n")); -+ printf(_(" -h, --help Show this help message\n")); -+ exit(0); -+} -+ - int main(int argc, char **argv) - { - char line[1024]; -@@ -380,14 +392,41 @@ - uint64_t cur_usage[8], cur_duration[8]; - double wakeups_per_second = 0; - -- read_data(&start_usage[0], &start_duration[0]); -- -- system("modprobe cpufreq_stats &> /dev/null"); -- - setlocale (LC_ALL, ""); - bindtextdomain ("powertop", "/usr/share/locale"); - textdomain ("powertop"); - -+ while (1) { -+ static struct option opts[] = { -+ { "dump", 0, NULL, 'd' }, -+ { "time", 1, NULL, 't' }, -+ { "help", 0, NULL, 'h' }, -+ { 0, 0, NULL, 0 } -+ }; -+ int index = 0, c; -+ -+ c = getopt_long(argc, argv, "dt:h", opts, &index); -+ if (c == -1) -+ break; -+ switch (c) { -+ case 'd': -+ dump = 1; -+ break; -+ case 't': -+ ticktime = strtod(optarg, NULL); -+ break; -+ case 'h': -+ usage(); -+ break; -+ default: -+ ; -+ } -+ } -+ -+ system("modprobe cpufreq_stats &> /dev/null"); -+ -+ read_data(&start_usage[0], &start_duration[0]); -+ - memcpy(last_usage, start_usage, sizeof(last_usage)); - memcpy(last_duration, start_duration, sizeof(last_duration)); - -@@ -441,12 +480,14 @@ - totalevents += cur_usage[i] - last_usage[i]; - } - -- if (!ncursesinited) { -+ if (!ncursesinited && !dump) { - initialize_curses(); - ncursesinited++; - } -- setup_windows(); -- show_title_bar(); -+ if (!dump) { -+ setup_windows(); -+ show_title_bar(); -+ } - - memset(&cstate_lines, 0, sizeof(cstate_lines)); - topcstate = -4; -@@ -459,7 +500,7 @@ - c0 = sysconf(_SC_NPROCESSORS_ONLN) * ticktime * 1000 * FREQ - totalticks; - if (c0 < 0) - c0 = 0; /* rounding errors in measurement might make c0 go slightly negative.. this is confusing */ -- sprintf(cstate_lines[0], _("Cn\t Avg residency (%is)\t\tP-states (frequencies)\n"), (int)ticktime); -+ sprintf(cstate_lines[0], _("Cn\t Avg residency (%is)\n"), (int)ticktime); - sprintf(cstate_lines[1], _("C0 (cpu running) (%4.1f%%)\n"), c0 * 100.0 / (sysconf(_SC_NPROCESSORS_ONLN) * ticktime * 1000 * FREQ)); - for (i = 0; i < 4; i++) - if (cur_usage[i]) { -@@ -594,7 +635,8 @@ - if (wakeups_per_second < 0) - ticktime = 2; - -- -+ if (dump) -+ exit(EXIT_SUCCESS); - reset_suggestions(); - - suggest_kernel_config("CONFIG_USB_SUSPEND", 1, -Only in powertop-1.7-new: powertop.c~ -diff -ru powertop-1.7/powertop.h powertop-1.7-new/powertop.h ---- powertop-1.7/powertop.h 2007-06-17 02:21:37.000000000 -0400 -+++ powertop-1.7-new/powertop.h 2007-06-28 16:38:30.000000000 -0400 -@@ -59,10 +59,11 @@ - - - extern char cstate_lines[6][200]; --extern char cpufreqstrings[4][80]; -+extern char cpufreqstrings[5][80]; - - extern int topcstate; - extern int topfreq; -+extern int dump; - - extern char status_bar_slots[10][40]; - extern char suggestion_key; diff --git a/powertop-1.7-less-gpm-slander-plz.patch b/powertop-1.7-less-gpm-slander-plz.patch index 27ac881..7aa423a 100644 --- a/powertop-1.7-less-gpm-slander-plz.patch +++ b/powertop-1.7-less-gpm-slander-plz.patch @@ -1,15 +1,18 @@ -diff -up powertop-1.7/powertop.c.jx powertop-1.7/powertop.c ---- powertop-1.7/powertop.c.jx 2007-06-17 21:16:31.000000000 -0400 -+++ powertop-1.7/powertop.c 2007-07-05 16:07:16.000000000 -0400 -@@ -631,12 +631,6 @@ int main(int argc, char **argv) +--- + powertop.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- powertop-1.8.orig/powertop.c ++++ powertop-1.8/powertop.c +@@ -700,12 +700,6 @@ int main(int argc, char **argv) "Beagle is the program that indexes for easy desktop search, however it's \n" "not very efficient and costs a significant amount of battery life."), 30); -- /* suggest to stop gnome-power-manager if it shows up in the top 10 and wakes up more than 10 times in the measurement */ +- /* suggest to stop gnome-power-manager only if it shows up in the top 10 and wakes up more than 10 times in the measurement */ - suggest_process_death("gnome-power-man : schedule_timeout (process_timeout)", "gnome-power-manager", lines, min(linehead,10), 10.0, - _("Suggestion: Disable or remove 'gnome-power-manager' from your system. \n" -- "Despite its name, some versions of gnome-power-manager end up costing more power \n" -- "than it'll ever save."), 5); +- "Older versions of gnome-power-manager wake up far more often than \n" +- "needed costing you some power."), 5); - /* suggest to stop pcscd if it shows up in the top 50 and wakes up at all*/ suggest_process_death("pcscd : ", "pcscd", lines, min(linehead,50), 1.0, diff --git a/powertop-1.7-strncpy.patch b/powertop-1.7-strncpy.patch index 921189e..eee486b 100644 --- a/powertop-1.7-strncpy.patch +++ b/powertop-1.7-strncpy.patch @@ -1,16 +1,21 @@ -diff -u powertop-1.7.orig/display.c powertop-1.7/display.c ---- powertop-1.7.orig/display.c 2007-06-18 03:16:33.000000000 +0200 -+++ powertop-1.7/display.c 2007-07-05 02:43:51.000000000 +0200 -@@ -44,7 +44,7 @@ - static WINDOW *status_bar_window; +--- + display.c | 8 ++++---- + powertop.h | 5 ++++- + suggestions.c | 4 ++-- + 3 files changed, 10 insertions(+), 7 deletions(-) + +--- powertop-1.8.orig/display.c ++++ powertop-1.8/display.c +@@ -45,7 +45,7 @@ static WINDOW *status_bar_window; + #define print(win, y, x, fmt, args...) do { if (dump) printf(fmt, ## args); else mvwprintw(win, y, x, fmt, ## args); } while (0) -char status_bar_slots[10][40]; +char status_bar_slots[STATUS_BAR_NR_SLOTS][STATUS_BAR_SLOTSIZE + 1]; static void cleanup_curses(void) { endwin(); -@@ -104,8 +104,8 @@ +@@ -105,8 +105,8 @@ void setup_windows(void) suggestion_window = subwin(stdscr, 3, maxx, maxy-4, 0); status_bar_window = subwin(stdscr, 1, maxx, maxy-1, 0); @@ -21,7 +26,7 @@ diff -u powertop-1.7.orig/display.c powertop-1.7/display.c werase(stdscr); refresh(); -@@ -148,7 +148,7 @@ +@@ -150,7 +150,7 @@ void show_title_bar(void) werase(status_bar_window); x = 0; @@ -30,49 +35,37 @@ diff -u powertop-1.7.orig/display.c powertop-1.7/display.c if (strlen(status_bar_slots[i])==0) continue; wattron(status_bar_window, A_REVERSE); -Gemeinsame Unterverzeichnisse: powertop-1.7.orig/po und powertop-1.7/po. -diff -u powertop-1.7.orig/powertop.h powertop-1.7/powertop.h ---- powertop-1.7.orig/powertop.h 2007-06-17 08:21:37.000000000 +0200 -+++ powertop-1.7/powertop.h 2007-07-05 02:39:53.000000000 +0200 -@@ -64,7 +64,10 @@ - extern int topcstate; +--- powertop-1.8.orig/powertop.h ++++ powertop-1.8/powertop.h +@@ -69,7 +69,10 @@ extern int topcstate; extern int topfreq; + extern int dump; -extern char status_bar_slots[10][40]; +#define STATUS_BAR_NR_SLOTS 10 -+#define STATUS_BAR_SLOTSIZE 40 ++#define STATUS_BAR_SLOTSIZE 40 +char status_bar_slots[STATUS_BAR_NR_SLOTS][STATUS_BAR_SLOTSIZE + 1]; + extern char suggestion_key; extern suggestion_func *suggestion_activate; -diff -u powertop-1.7.orig/suggestions.c powertop-1.7/suggestions.c ---- powertop-1.7.orig/suggestions.c 2007-06-08 07:33:13.000000000 +0200 -+++ powertop-1.7/suggestions.c 2007-07-05 02:42:59.000000000 +0200 -@@ -70,7 +70,7 @@ +--- powertop-1.8.orig/suggestions.c ++++ powertop-1.8/suggestions.c +@@ -71,7 +71,7 @@ void reset_suggestions(void) ptr = next; } suggestions = NULL; -- strcpy(status_bar_slots[9],""); -+ strncpy(status_bar_slots[9], "", STATUS_BAR_SLOTSIZE); +- strcpy(status_bar_slots[8],""); ++ strncpy(status_bar_slots[8],"", STATUS_BAR_SLOTSIZE); suggestion_key = 255; suggestion_activate = NULL; total_weight = 0; -@@ -103,7 +103,7 @@ - int value, running = 0; +@@ -105,7 +105,7 @@ void pick_suggestion(void) struct suggestion *ptr; + int weight; -- strcpy(status_bar_slots[9],""); -+ strncpy(status_bar_slots[9], "", STATUS_BAR_SLOTSIZE); +- strcpy(status_bar_slots[8],""); ++ strncpy(status_bar_slots[8],"", STATUS_BAR_SLOTSIZE); suggestion_key = 255; suggestion_activate = NULL; -@@ -119,7 +119,7 @@ - running += ptr->weight; - if (running > value) { - if (ptr->keystring) -- strcpy(status_bar_slots[9],ptr->keystring); -+ strncpy(status_bar_slots[9], ptr->keystring, STATUS_BAR_SLOTSIZE); - suggestion_key = ptr->key; - suggestion_activate = ptr->func; - show_suggestion(ptr->string); diff --git a/powertop.spec b/powertop.spec index d578ce9..c3e65ec 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,6 +1,6 @@ Name: powertop -Version: 1.7 -Release: 4%{?dist} +Version: 1.8 +Release: 1%{?dist} Summary: Power consumption monitor Group: Applications/System @@ -14,7 +14,6 @@ BuildRequires: ncurses-devel Patch0: powertop-1.7-less-gpm-slander-plz.patch Patch1: powertop-1.7-strncpy.patch -Patch2: powertop-1.7-dump.patch %description PowerTOP is a tool that finds the software component(s) that make your @@ -24,9 +23,6 @@ computer use more power than necessary while it is idle. %setup -q %patch0 -p1 -b .g-p-m %patch1 -p1 -b .strncpy -# Allow dumping to stdout. Warning: watch for new mvwprintw statements -# when rebasing! -%patch2 -p1 -b .dump %build export CFLAGS="$RPM_OPT_FLAGS" @@ -47,6 +43,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/powertop.1* %changelog +* Mon Aug 20 2007 Josh Boyer 1.8-1 +- Update to latest release + * Mon Jul 23 2007 Bill Nottingham 1.7-4 - add patch to allow dumping output to stdout diff --git a/sources b/sources index bbdd5e2..fb7b16d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -84c012fe5e866b5deb588606a6b9822b powertop-1.7.tar.gz +38fd8a6825cd62b6c22df8a44b4e27d0 powertop-1.8.tar.gz