[PATCH] fix cpuidle state name parsing
by Rajagopal Venkat
parse cpuidle C state based on sysfs file entry(stateX)
instead of state name/description
Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
src/cpu/abstract_cpu.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cpu/abstract_cpu.cpp b/src/cpu/abstract_cpu.cpp
index cd4eba0..72969fc 100644
--- a/src/cpu/abstract_cpu.cpp
+++ b/src/cpu/abstract_cpu.cpp
@@ -147,7 +147,7 @@ void abstract_cpu::insert_cstate(const char *linux_name, const char *human_name,
strcpy(state->linux_name, linux_name);
strcpy(state->human_name, human_name);
- c = human_name;
+ c = linux_name;
while (*c) {
if (strcmp(linux_name, "active")==0) {
state->line_level = LEVEL_C0;
--
1.7.9.5
9 years, 11 months
[PATCH v3] conditionally disable pci if not supported
by Rajagopal Venkat
disable pci if not supported by host platform. When
libpci is not found, define a macro which will be
used for conditional compilation.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
configure.ac | 5 +++--
src/lib.cpp | 20 ++++++++++++++++++--
src/lib.h | 5 +++++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4da4eea..3cbc7b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,8 +48,9 @@ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap p
AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), [])
PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[
- AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), [])
-])
+ AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported]), [])
+])
+
PKG_CHECK_MODULES([LIBZ], [zlib],[],[
AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but was not found]), [])
])
diff --git a/src/lib.cpp b/src/lib.cpp
index 0f87e48..77e49a2 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -35,11 +35,13 @@
#include <math.h>
#include <stdlib.h>
+#include "lib.h"
+
+#ifndef HAVE_NO_PCI
extern "C" {
#include <pci/pci.h>
}
-
-#include "lib.h"
+#endif
#include <stdio.h>
#include <stdint.h>
@@ -266,6 +268,7 @@ void format_watts(double W, char *buffer, unsigned int len)
}
+#ifndef HAVE_NO_PCI
static struct pci_access *pci_access;
char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
@@ -290,6 +293,19 @@ void end_pci_access(void)
pci_free_name_list(pci_access);
}
+#else
+
+char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
+{
+ return NULL;
+}
+
+void end_pci_access(void)
+{
+}
+
+#endif /* HAVE_NO_PCI */
+
int utf_ok = -1;
diff --git a/src/lib.h b/src/lib.h
index 588c023..7093b7f 100644
--- a/src/lib.h
+++ b/src/lib.h
@@ -30,6 +30,11 @@
#endif
#include <stdint.h>
+/* Include only for Automake builds */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef DISABLE_I18N
#define _(STRING) gettext(STRING)
#else
--
1.7.9.5
9 years, 11 months
[bugreport] crash on powertop --debug --html=file.html
by Jan-Simon Möller
Hi all!
With git HEAD I see this crash:
$ ./src/powertop --debug --html=/home/dl9pf/powertop.1.html
Loaded 0 prior measurements
Preparing to take measurements
Taking 1 measurement(s) for a duration of 20 second(s) each.
Segmentation fault (core dumped)
$ gdb ./src/powertop core
GNU gdb (GDB) SUSE (7.4.50.20120603-77.1)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/dl9pf/user/git/LF/powertop/src/powertop...done.
[New LWP 2714]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./src/powertop --debug --
html=/home/dl9pf/powertop.1.html'.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000041f1dc in devlist_sort (i=0x875720, j=0x211) at
devlist.cpp:273
273 if (i->pid != j->pid)
(gdb) bt full
#0 0x000000000041f1dc in devlist_sort (i=0x875720, j=0x211) at
devlist.cpp:273
No locals.
#1 0x00000000004218b8 in
std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator<devuser**,
std::vector<devuser*, std::allocator<devuser*> > root@aragorn:
/home/dl9pf/user/git/LF/powertop
[17:03]
__val = 0x875720
__next = {_M_current = 0x889288}
#2 0x0000000000421071 in
std::__unguarded_insertion_sort<__gnu_cxx::__normal_iterator<devuser**,
std::vector<devuser*, std::allocator<devuser*> > >, bool (*)(devuser*,
devuser*)> (__first=..., __last=..., __comp=0x41f1c2 <devlist_sort(devuser*,
devuser*)>)
at /usr/include/c++/4.5/bits/stl_algo.h:2160
__i = {_M_current = 0x889318}
#3 0x0000000000420358 in
std::__final_insertion_sort<__gnu_cxx::__normal_iterator<devuser**,
std::vector<devuser*, std::allocator<devuser*> > >, bool (*)(devuser*,
devuser*)> (__first=..., __last=..., __comp=0x41f1c2 <devlist_sort(devuser*,
devuser*)>)
at /usr/include/c++/4.5/bits/stl_algo.h:2193
No locals.
#4 0x000000000041f948 in std::sort<__gnu_cxx::__normal_iterator<devuser**,
std::vector<devuser*, std::allocator<devuser*> > >, bool (*)(devuser*,
devuser*)> (__first=..., __last=..., __comp=0x41f1c2 <devlist_sort(devuser*,
devuser*)>) at /usr/include/c++/4.5/bits/stl_algo.h:5252
No locals.
#5 0x000000000041f2e5 in report_show_open_devices () at devlist.cpp:306
target = 0x68edc0 <two>
i = 0
prev =
"\000_Y=\377\177\000\000\000\000\000\000\000\000\000\000\240_Y=\377\177\000\000@\332h\000\000\000\000\000\240\332h\000\000\000\000\000P\241\206",
'\000' <repeats 29 times>,
"\020\362h\000\000\000\000\000\360_Y=\377\177\000\000&\203@\000\000\000\000\000\360_Y=\377\177\000\000EKh\201x\230Y@\240\332h\000\000\000\000\000@\332h\000\000\000\000"
proc =
"\200\360h\000\000\000\000\000\001\000\000\000\000\000\000\000\350bU\001\000\000\000\000\340bU\001\000\000\000\000\020_Y=\377\177\000\000\020\320<\357\177\177\000\000\061\000\000\000\000\000\000\000\250\332h\000\000\000\000\000@_Y=\377\177\000\000\224\201@\000\000\000\000\000h_Y=\377\177\000\000\000\000\000\000\000\000\000\000
0,0%\000kts/s\000\000\000\000\240_Y=\377\177\000\000T\016D\000\000\000\000"
#6 0x0000000000454a9b in one_measurement (seconds=20, workload=0x7fff3d5960a0
"") at main.cpp:223
tmp = 0
#7 0x0000000000454d81 in report (time=20, workload=0x7fff3d5960a0 "",
iterations=1, file=0x7fff3d5970a0 "/home/dl9pf/powertop.1.html")
at main.cpp:274
i = 0
#8 0x0000000000455287 in main (argc=3, argv=0x7fff3d5981a8) at main.cpp:434
option_index = 4
c = -1
wantreport = true
iterations = 1
It runs with:
diff --git a/src/devlist.cpp b/src/devlist.cpp
index 93f2081..de98214 100644
--- a/src/devlist.cpp
+++ b/src/devlist.cpp
@@ -303,7 +303,7 @@ void report_show_open_devices(void)
if (target->size() == 0)
return;
- sort(target->begin(), target->end(), devlist_sort);
+// sort(target->begin(), target->end(), devlist_sort);
if (reporttype) {
fprintf(reportout.http_report,"<h2>Process device
activity</h2>\n <table width=\"100%%\">\n");
Looks like something is fishy in the sort for this case.
Best,
Jan-Simon
9 years, 12 months
power usage in watts is not displayed
by Srikanth Grama Ramaprasad
Dear Sir/Madam,
I am trying to install powerTop on my PC as I need to know the per
process power consumption.
I have the Ubuntu 11.10 installed on my PC.
I installed the package available in Ubuntu Synaptic Package Manger
but the power consumption in watts is not displayed.
I get the message "no ACPI power usage estimate available".
Is there any configuration settings that I am missing ?
Could you please tell me on which version of the kernel is powerTop supported ?
Also in the readme file it says "The patches in the patches/
sub-directory are required for PowerTOP to function fully." but I was
not able to find this directory in the tar.bz2.
Could you please also tell me where I will find the patches directory ?
Thanking you,
Srikanth
10 years
[PATCH] prevent jump on uninitialized value
by Sergey Senozhatsky
workload is getting 'initialized' with stack garbage,
so later conditional check of !workload[0] in report()
is invalid.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
src/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.cpp b/src/main.cpp
index d8e2a47..7a1b976 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -356,7 +356,7 @@ int main(int argc, char **argv)
int c;
bool wantreport = FALSE;
char filename[4096];
- char workload[4096];
+ char workload[4096] = {0,};
int iterations = 1;
#ifndef DISABLE_TRYCATCH
10 years
[PATCH] remove -Werror from AM_INIT_AUTOMAKE
by Benedikt Morbach
While this is nice while developing, it may cause
various problems with distributed tarballs.
A new automake version could add a warning, causing errors for distributions
and users, who might need to patch configure.ac and thus run autoreconf.
For example, we hit an error where a third party package (gettext) uses
functionality (AM_PROG_MKDIR_P) which is deprecated in newer automake versions(1.12.1),
causing the powertop build to fail.
Since the problem lies elsewhere, it is stupid to fail for this while building powertop
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 4da4eea..ff4cdea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.68])
AC_INIT([powertop], [2.0], [powertop(a)lists.01.org])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign ])
+AM_INIT_AUTOMAKE([-Wall foreign ])
AC_LANG([C++])
AC_CONFIG_FILES([Makefile src/Makefile pevent/Makefile po/Makefile.in doc/Makefile])
AC_CONFIG_SRCDIR([src/main.cpp])
--
1.7.10.4
10 years
Re: [Powertop] [bugreport] crash on powertop --debug --html=file.html
by Jan-Simon Möller
Am Dienstag, 26. Juni 2012, 20:50:04 schrieb Chris Ferron:
> On 06/26/2012 11:42 AM, Chris Ferron wrote:
> > On 06/26/2012 08:10 AM, Jan-Simon Möller wrote:
> >> Hi all!
> >> With git HEAD I see this crash:
> >>
> >> $ ./src/powertop --debug --html=/home/dl9pf/powertop.1.html
> >
> > hum thanks for the trace, but can you give me more info on your system?
openSUSE 11.4 on x86_64 (i7-2)
> > What kernel are you running? Can you send me your kernel config?
$ uname -r
3.5.0-rc4-debug2
$ free
total used free shared buffers cached
Mem: 16442236 9311340 7130896 0 2981216 4891608
-/+ buffers/cache: 1438516 15003720
Swap: 35649528 0 35649528
$ cat /etc/SuSE-release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.5/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --
mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-
languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --
with-gxx-include-dir=/usr/include/c++/4.5 --enable-ssp --disable-libssp --
disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE
Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-
system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-
libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.5 --
enable-linux-futex --without-system-libunwind --enable-gold --with-plugin-
ld=/usr/bin/gold --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-
linux
Thread model: posix
gcc version 4.5.3 20110428 [gcc-4_5-branch revision 173117] (SUSE Linux)
$ for i in `grep CONFIG README` ; do echo -n "$i : " ; zcat /proc/config.gz |
grep "$i=y" ; done
CONFIG_NO_HZ : CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS : CONFIG_HIGH_RES_TIMERS=y
CONFIG_HPET_TIMER : CONFIG_HPET_TIMER=y
CONFIG_CPU_FREQ_GOV_ONDEMAND : CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_USB_SUSPEND : CONFIG_USB_SUSPEND=y
CONFIG_SND_AC97_POWER_SAVE : CONFIG_SND_AC97_POWER_SAVE=y
CONFIG_TIMER_STATS : CONFIG_TIMER_STATS=y
CONFIG_PERF_EVENTS : CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS : CONFIG_TRACEPOINTS : CONFIG_TRACEPOINTS=y
CONFIG_TRACING : CONFIG_TRACING=y
CONFIG_EVENT_POWER_TRACING_DEPRECATED :
CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_ACPI_PROCFS_POWER : CONFIG_ACPI_PROCFS_POWER=y
Config attached.
> >
> >
> > and are you modifying power to build on suse in any way?
No change in powertop. Just git clone + ./configure/make/make install
Best,
Jan-Simon
10 years
[PATCH v2] conditionally disable pci if not supported
by Rajagopal Venkat
Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
configure.ac | 5 +++--
src/lib.cpp | 20 ++++++++++++++++++--
src/lib.h | 4 ++++
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4da4eea..3cbc7b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,8 +48,9 @@ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap p
AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), [])
PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[
- AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), [])
-])
+ AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported]), [])
+])
+
PKG_CHECK_MODULES([LIBZ], [zlib],[],[
AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but was not found]), [])
])
diff --git a/src/lib.cpp b/src/lib.cpp
index 0f87e48..77e49a2 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -35,11 +35,13 @@
#include <math.h>
#include <stdlib.h>
+#include "lib.h"
+
+#ifndef HAVE_NO_PCI
extern "C" {
#include <pci/pci.h>
}
-
-#include "lib.h"
+#endif
#include <stdio.h>
#include <stdint.h>
@@ -266,6 +268,7 @@ void format_watts(double W, char *buffer, unsigned int len)
}
+#ifndef HAVE_NO_PCI
static struct pci_access *pci_access;
char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
@@ -290,6 +293,19 @@ void end_pci_access(void)
pci_free_name_list(pci_access);
}
+#else
+
+char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
+{
+ return NULL;
+}
+
+void end_pci_access(void)
+{
+}
+
+#endif /* HAVE_NO_PCI */
+
int utf_ok = -1;
diff --git a/src/lib.h b/src/lib.h
index 588c023..d354151 100644
--- a/src/lib.h
+++ b/src/lib.h
@@ -30,6 +30,10 @@
#endif
#include <stdint.h>
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef DISABLE_I18N
#define _(STRING) gettext(STRING)
#else
--
1.7.9.5
10 years
[PATCH] conditionally disable pci support on ARM platforms
by Rajagopal Venkat
Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
configure.ac | 16 +++++++++++++---
src/lib.cpp | 20 ++++++++++++++++++--
src/lib.h | 4 ++++
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4da4eea..c2ff430 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,8 @@ AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_CC_C_O
+AC_CANONICAL_HOST
+PKG_PROG_PKG_CONFIG
# Checks for libraries.
# Checks for header files.
@@ -47,9 +49,17 @@ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap p
AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), [])
-PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[
- AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), [])
-])
+case "$host" in
+arm*)
+ AC_DEFINE([HAVE_NO_PCI],[1],[Define if host platform is ARM])
+ ;;
+*)
+ PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[
+ AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), [])
+ ])
+ ;;
+esac
+
PKG_CHECK_MODULES([LIBZ], [zlib],[],[
AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but was not found]), [])
])
diff --git a/src/lib.cpp b/src/lib.cpp
index 0f87e48..77e49a2 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -35,11 +35,13 @@
#include <math.h>
#include <stdlib.h>
+#include "lib.h"
+
+#ifndef HAVE_NO_PCI
extern "C" {
#include <pci/pci.h>
}
-
-#include "lib.h"
+#endif
#include <stdio.h>
#include <stdint.h>
@@ -266,6 +268,7 @@ void format_watts(double W, char *buffer, unsigned int len)
}
+#ifndef HAVE_NO_PCI
static struct pci_access *pci_access;
char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
@@ -290,6 +293,19 @@ void end_pci_access(void)
pci_free_name_list(pci_access);
}
+#else
+
+char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len)
+{
+ return NULL;
+}
+
+void end_pci_access(void)
+{
+}
+
+#endif /* HAVE_NO_PCI */
+
int utf_ok = -1;
diff --git a/src/lib.h b/src/lib.h
index 588c023..d354151 100644
--- a/src/lib.h
+++ b/src/lib.h
@@ -30,6 +30,10 @@
#endif
#include <stdint.h>
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef DISABLE_I18N
#define _(STRING) gettext(STRING)
#else
--
1.7.9.5
10 years
[PATCH] Use printf, not sprintf, to print messages to stdout.
by Magnus Fromreide
This undos the last printf->sprintf change from 8fd54ace.
Signed-off-by: Magnus Fromreide <magfr(a)lysator.liu.se>
---
src/main.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 880d745..a2d8700 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -229,7 +229,7 @@ void one_measurement(int seconds, char *workload)
void out_of_memory()
{
reset_display();
- sprintf("%s...\n",_("PowerTOP is out of memory. PowerTOP is Aborting"));
+ printf("%s...\n",_("PowerTOP is out of memory. PowerTOP is Aborting"));
abort();
}
@@ -458,7 +458,7 @@ int main(int argc, char **argv)
#ifndef DISABLE_NCURSES
endwin();
#endif
- sprintf("%s\n", _("Leaving PowerTOP"));
+ printf("%s\n", _("Leaving PowerTOP"));
end_process_data();
clear_process_data();
--
1.7.10
10 years