Hello community,
here is the log from the commit of package powertop
checked in at Tue May 22 15:11:56 CEST 2007.
--------
--- powertop/powertop.changes 2007-05-15 10:29:44.000000000 +0200
+++ /mounts/work_src_done/STABLE/powertop/powertop.changes 2007-05-22 13:56:05.667313000 +0200
@@ -1,0 +2,15 @@
+Tue May 22 13:41:56 CEST 2007 - thoenig@suse.de
+
+- Update to PowerTOP 1.3
+- Remove patch powertop-fix-compiler-warnings-thoenig-02.patch:
+ merged upstream
+- Changes:
+ * Add suggestion for CONFIG_SND_AC97_POWER_SAVE
+ * Fix inefficient code for readdir (Vince Pinter)
+ * Highlight the worst offenders in bold (Vince Pinter)
+ * Fix crash when running on 2.4 kernels (Harald Fernengel)
+ * Check fgets() return values (Timom Hoenig @ SuSE)
+ * add suggestion to enable laptop mode (when disabled)
+ * add suggestion to disable bluetooth when unused
+
+-------------------------------------------------------------------
Old:
----
powertop-1.2.tar.gz
powertop-fix-compiler-warnings-thoenig-02.patch
New:
----
powertop-1.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ powertop.spec ++++++
--- /var/tmp/diff_new_pack.m26156/_old 2007-05-22 15:11:22.000000000 +0200
+++ /var/tmp/diff_new_pack.m26156/_new 2007-05-22 15:11:22.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package powertop (Version 1.2)
+# spec file for package powertop (Version 1.3)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -13,12 +13,11 @@
Name: powertop
URL: http://www.linuxpowertop.org
Summary: PowerTOP is a Linux tool to find out what is using power on a laptop
-Version: 1.2
+Version: 1.3
Release: 1
License: GNU General Public License (GPL)
Group: System/Monitoring
Source0: %{name}-%{version}.tar.gz
-Patch0: %{name}-fix-compiler-warnings-thoenig-02.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Autoreqprov: on
@@ -35,7 +34,6 @@
%prep
%setup
-%patch0 -p0
%build
CFLAGS="$RPM_OPT_FLAGS" make
@@ -53,6 +51,18 @@
%{_bindir}/%{name}
%changelog
+* Tue May 22 2007 - thoenig@suse.de
+- Update to PowerTOP 1.3
+- Remove patch powertop-fix-compiler-warnings-thoenig-02.patch:
+ merged upstream
+- Changes:
+ * Add suggestion for CONFIG_SND_AC97_POWER_SAVE
+ * Fix inefficient code for readdir (Vince Pinter)
+ * Highlight the worst offenders in bold (Vince Pinter)
+ * Fix crash when running on 2.4 kernels (Harald Fernengel)
+ * Check fgets() return values (Timom Hoenig @ SuSE)
+ * add suggestion to enable laptop mode (when disabled)
+ * add suggestion to disable bluetooth when unused
* Tue May 15 2007 - thoenig@suse.de
- Update to PowerTOP 1.2 (skipped 1.1)
- Fix battery code to work with both, mA and mW
++++++ powertop-1.2.tar.gz -> powertop-1.3.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/bluetooth.c new/powertop-1.3/bluetooth.c
--- old/powertop-1.2/bluetooth.c 1970-01-01 01:00:00.000000000 +0100
+++ new/powertop-1.3/bluetooth.c 2007-05-22 00:23:46.000000000 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2007, Intel Corporation
+ *
+ * This file is part of PowerTOP
+ *
+ * This program file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Arjan van de Ven
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "powertop.h"
+
+
+/* structure definitions copied from include/net/bluetooth/hci.h from the 2.6.20 kernel */
+#define HCIGETDEVINFO _IOR('H', 211, int)
+#define BTPROTO_HCI 1
+
+#define __u16 uint16_t
+#define __u8 uint8_t
+#define __u32 uint32_t
+
+typedef struct {
+ __u8 b[6];
+} __attribute__((packed)) bdaddr_t;
+
+struct hci_dev_stats {
+ __u32 err_rx;
+ __u32 err_tx;
+ __u32 cmd_tx;
+ __u32 evt_rx;
+ __u32 acl_tx;
+ __u32 acl_rx;
+ __u32 sco_tx;
+ __u32 sco_rx;
+ __u32 byte_rx;
+ __u32 byte_tx;
+};
+
+
+struct hci_dev_info {
+ __u16 dev_id;
+ char name[8];
+
+ bdaddr_t bdaddr;
+
+ __u32 flags;
+ __u8 type;
+
+ __u8 features[8];
+
+ __u32 pkt_type;
+ __u32 link_policy;
+ __u32 link_mode;
+
+ __u16 acl_mtu;
+ __u16 acl_pkts;
+ __u16 sco_mtu;
+ __u16 sco_pkts;
+
+ struct hci_dev_stats stat;
+};
+
+static int previous_bytes = -1;
+
+void suggest_bluetooth_off(void)
+{
+ struct hci_dev_info devinfo;
+ int fd;
+ int ret;
+ int thisbytes = 0;
+
+ if (suggestioncount > 0)
+ return;
+
+ fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ if (fd < 0)
+ return;
+
+ memset(&devinfo, 0, sizeof(devinfo));
+ strcpy(devinfo.name, "hci0");
+ ret = ioctl(fd, HCIGETDEVINFO, (void *) &devinfo);
+ if (ret < 0)
+ goto out;
+
+ if ( (devinfo.flags & 1) == 0) /* interface down already */
+ goto out;
+
+ thisbytes += devinfo.stat.byte_rx;
+ thisbytes += devinfo.stat.byte_tx;
+
+ if (thisbytes == previous_bytes) {
+ printf( "Suggestion: Disable the unused bluetooth interface with the following command:\n"
+ " hciconfig hci0 down \n"
+ "Bluetooth is a radio and consumes quite some power, and keeps USB busy as well.\n");
+ suggestioncount++;
+ }
+ previous_bytes = thisbytes;
+
+out:
+ close(fd);
+ return;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/Changelog new/powertop-1.3/Changelog
--- old/powertop-1.2/Changelog 2007-05-15 01:41:39.000000000 +0200
+++ new/powertop-1.3/Changelog 2007-05-22 00:24:05.000000000 +0200
@@ -1,3 +1,12 @@
+1.3 --
+ * Add suggestion for CONFIG_SND_AC97_POWER_SAVE
+ * Fix inefficient code for readdir (Vince Pinter)
+ * Highlight the worst offenders in bold (Vince Pinter)
+ * Fix crash when running on 2.4 kernels (Harald Fernengel)
+ * Check fgets() return values (Timom Hoenig @ SuSE)
+ * add suggestion to enable laptop mode (when disabled)
+ * add suggestion to disable bluetooth when unused
+
1.2 -- May 14th, 2007
* Manpage contributed by Carlo Segre from the Debian project
* Fix "shows power usage even on AC" bug, spotted by Steinar
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/config.c new/powertop-1.3/config.c
--- old/powertop-1.2/config.c 2007-05-13 19:22:30.000000000 +0200
+++ new/powertop-1.3/config.c 2007-05-18 20:32:09.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, Intel Corporation
+ * Copyright 2007, Intel Corporation
*
* This file is part of PowerTOP
*
@@ -47,7 +47,8 @@
file = popen("zcat /proc/config.gz", "r");
while (file && !feof(file)) {
char line[100];
- fgets(line, 100, file);
+ if (fgets(line, 100, file) == NULL)
+ break;
strcpy(configlines[configcount++], line);
}
pclose(file);
@@ -56,7 +57,10 @@
file = fopen("/proc/sys/kernel/osrelease", "r");
if (!file)
return;
- fgets(version, 100, file);
+ if (fgets(version, 100, file) == NULL) {
+ fclose(file);
+ return;
+ }
fclose(file);
c = strchr(version, '\n');
if (c)
@@ -71,7 +75,8 @@
return;
while (!feof(file)) {
char line[100];
- fgets(line, 100, file);
+ if (fgets(line, 100, file) == NULL)
+ break;
strcpy(configlines[configcount++], line);
}
fclose(file);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/Makefile new/powertop-1.3/Makefile
--- old/powertop-1.2/Makefile 2007-05-14 18:36:35.000000000 +0200
+++ new/powertop-1.3/Makefile 2007-05-22 00:06:36.000000000 +0200
@@ -3,8 +3,8 @@
CFLAGS?=-O2 -g ${WARNFLAGS}
CC?=gcc
-powertop: powertop.c config.c process.c Makefile powertop.h
- $(CC) ${CFLAGS} powertop.c config.c process.c -o powertop
+powertop: powertop.c config.c process.c misctips.c bluetooth.c Makefile powertop.h
+ $(CC) ${CFLAGS} powertop.c config.c process.c misctips.c bluetooth.c -o powertop
install: powertop
mkdir -p ${DESTDIR}${BINDIR}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/misctips.c new/powertop-1.3/misctips.c
--- old/powertop-1.2/misctips.c 1970-01-01 01:00:00.000000000 +0100
+++ new/powertop-1.3/misctips.c 2007-05-21 22:36:39.000000000 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2007, Intel Corporation
+ *
+ * This file is part of PowerTOP
+ *
+ * This program file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program in a file named COPYING; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Arjan van de Ven
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "powertop.h"
+
+void suggest_laptop_mode(void)
+{
+ FILE *file;
+ int i;
+ char buffer[1024];
+ if (suggestioncount > 0)
+ return;
+ file = fopen("/proc/sys/vm/laptop_mode", "r");
+ if (!file)
+ return;
+ memset(buffer, 0, 1024);
+ if (!fgets(buffer, 1023, file)) {
+ fclose(file);
+ return;
+ }
+ i = strtoul(buffer, NULL, 10);
+ if (i<1) {
+ printf( "Suggestion: Enable laptop-mode by executing the following command:\n"
+ " echo 5 > /proc/sys/vm/laptop_mode \n"
+ "and/or putting this command into /etc/rc.local\n");
+ suggestioncount++;
+ }
+ fclose(file);
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/powertop.c new/powertop-1.3/powertop.c
--- old/powertop-1.2/powertop.c 2007-05-15 01:41:30.000000000 +0200
+++ new/powertop-1.3/powertop.c 2007-05-22 00:38:51.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, Intel Corporation
+ * Copyright 2007, Intel Corporation
*
* This file is part of PowerTOP
*
@@ -135,7 +135,8 @@
int nr = -1;
uint64_t count = 0;
memset(line, 0, sizeof(line));
- fgets(line, 1024, file);
+ if (fgets(line, 1024, file) == NULL)
+ break;
c = strchr(line, ':');
if (!c)
continue;
@@ -153,9 +154,13 @@
c = newc;
}
c = strchr(c, ' ');
+ if (!c)
+ continue;
while (c && *c == ' ')
c++;
c = strchr(c, ' ');
+ if (!c)
+ continue;
while (c && *c == ' ')
c++;
name = c;
@@ -199,12 +204,13 @@
while (!feof(file)) {
memset(line, 0, 4096);
- fgets(line, 4096, file);
+ if (fgets(line, 4096, file) == NULL)
+ break;
c = strstr(line, "age[");
if (!c)
continue;
c += 4;
- usage[clevel] += strtoull(c, NULL, 10);
+ usage[clevel] += 1+strtoull(c, NULL, 10);
c = strstr(line, "ation[");
if (!c)
continue;
@@ -256,6 +262,10 @@
{
printf("\33[41m\33[1m");
}
+void bold(void)
+{
+ printf("\33[1m");
+}
void normal(void)
{
printf("\33[0m");
@@ -294,11 +304,16 @@
double watts_drawn = 0.0;
double amperes_left = 0.0;
double watts_left = 0.0;
+ char line[1024];
+
+ if (strlen(dirent->d_name) < 3)
+ continue;
+
sprintf(filename, "/proc/acpi/battery/%s/state", dirent->d_name);
file = fopen(filename, "r");
if (!file)
continue;
- char line[1024];
+
while (fgets(line, 1024, file) != NULL) {
char *c;
if (strstr(line, "present:") && strstr(line, "no"))
@@ -355,7 +370,7 @@
memset(cur_usage, 0, sizeof(cur_usage));
memset(cur_duration, 0, sizeof(cur_duration));
- printf("PowerTOP 1.2 (C) 2007 Intel Corporation \n\n");
+ printf("PowerTOP 1.3 (C) 2007 Intel Corporation \n\n");
if (getuid() != 0)
printf("PowerTOP needs to be run as root to collect enough information\n");
printf("Collecting data for %i seconds \n", ticktime);
@@ -381,7 +396,7 @@
totalevents += cur_usage[i] - last_usage[i];
}
- printf("\33[H\33[J\33[47m\33[30m PowerTOP version 1.2 (C) 2007 Intel Corporation \n");
+ printf("\33[H\33[J\33[47m\33[30m PowerTOP version 1.3 (C) 2007 Intel Corporation \n");
normal();
printf("\n");
if (totalevents == 0) {
@@ -420,7 +435,8 @@
while (file && !feof(file)) {
char *count, *pid, *process, *func;
int cnt;
- fgets(line, 1024, file);
+ if (fgets(line, 1024, file) == NULL)
+ break;
if (strstr(line, "total events"))
break;
c = count = &line[0];
@@ -489,19 +505,25 @@
sort_lines();
printf("\nTop causes for wakeups:\n");
for (i = 0; i < linehead; i++)
- if (lines[i].count > 0 && counter++ < 10)
+ if (lines[i].count > 0 && counter++ < 10) {
+ if ((lines[i].count * 1.0 / ticktime) >= 10.0)
+ bold();
+ else
+ normal();
printf(" %5.1f%% (%4.1f) %s \n", lines[i].count * 100.0 / linectotal,
lines[i].count * 1.0 / ticktime,
lines[i].string);
- fflush(stdout);
+ }
} else {
if (getuid() == 0) {
printf("No detailed statistics available; please enable the CONFIG_TIMER_STATS kernel option\n");
printf("This option is located in the Kernel Debugging section of menuconfig\n");
printf("(which is CONFIG_DEBUG_KERNEL=y in the config file)\n");
+ printf("Note: this is only available in 2.6.21 and later kernels\n");
} else
printf("No detailed statistics available; PowerTOP needs root privileges for that\n");
}
+ normal();
if (maxsleep < 5.0)
ticktime = 5;
else if (maxsleep < 30.0)
@@ -515,22 +537,29 @@
printf("\n");
suggestioncount = 0;
+ suggest_kernel_config("CONFIG_USB_SUSPEND", 1,
+ "Suggestion: Enable the CONFIG_USB_SUSPEND kernel configuration option.\nThis option will automatically disable UHCI USB when not in use, and may\nsave approximately 1 Watt of power.");
suggest_process_death("beagled : schedule_timeout", lines, min(linehead,20),
"Suggestion: Disable or remove 'beagle' from your system. \n"
"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.");
- suggest_kernel_config("CONFIG_USB_SUSPEND", 1,
- "Suggestion: Enable the CONFIG_USB_SUSPEND kernel configuration option.\nThis option will automatically disable UHCI USB when not in use, and may\nsave approximately 1 Watt of power.");
+ suggest_bluetooth_off();
suggest_kernel_config("CONFIG_CPU_FREQ_GOV_ONDEMAND", 1,
"Suggestion: Enable the CONFIG_CPU_FREQ_GOV_ONDEMAND kernel configuration option.\n"
"The 'ondemand' CPU speed governer will minimize the CPU power usage while\n" "giving you performance when it is needed.");
suggest_kernel_config("CONFIG_NO_HZ", 1, "Suggestion: Enable the CONFIG_NO_HZ kernel configuration option.\nThis option is required to get any kind of longer sleep times in the CPU.");
- suggest_kernel_config("CONFIG_HPET", 1,
+ suggest_kernel_config("CONFIG_HPET_TIMER", 1,
"Suggestion: Enable the CONFIG_HPET kernel configuration option.\n"
"Without HPET support the kernel needs to wake up every 20 miliseconds for \n" "some housekeeping tasks.");
+ suggest_laptop_mode();
+ suggest_kernel_config("CONFIG_SND_AC97_POWER_SAVE", 1,
+ "Suggestion: Enable the CONFIG_SND_AC97_POWER_SAVE kernel configuration option.\n"
+ "This option will automatically power down your sound codec when not in use,\n"
+ "and can save approximately half a Watt of power.");
suggest_kernel_config("CONFIG_IRQBALANCE", 0,
"Suggestion: Disable the CONFIG_IRQBALANCE kernel configuration option.\n" "The in-kernel irq balancer is obsolete and wakes the CPU up far more than needed.");
+ fflush(stdout);
sleep(3); /* quiet down the effects of any IO to xterms */
read_data(&cur_usage[0], &cur_duration[0]);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/powertop.h new/powertop-1.3/powertop.h
--- old/powertop-1.2/powertop.h 2007-05-13 19:25:35.000000000 +0200
+++ new/powertop-1.3/powertop.h 2007-05-22 00:17:31.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, Intel Corporation
+ * Copyright 2007, Intel Corporation
*
* This file is part of PowerTOP
*
@@ -33,6 +33,8 @@
void suggest_process_death(char *process, struct line *lines, int linecount, char *comment);
void suggest_kernel_config(char *string, int onoff, char *comment);
+void suggest_laptop_mode(void);
+void suggest_bluetooth_off(void);
extern int suggestioncount;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powertop-1.2/process.c new/powertop-1.3/process.c
--- old/powertop-1.2/process.c 2007-05-13 19:22:42.000000000 +0200
+++ new/powertop-1.3/process.c 2007-05-18 20:32:28.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, Intel Corporation
+ * Copyright 2007, Intel Corporation
*
* This file is part of PowerTOP
*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org