Skip to contentSkip to conversation

pull: various changes, mostly build system related

PATCH Superseded Sami Kerola 3 participants 19 messages Oct 25, 2014 – Nov 9, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sami Kerola

author
#0 lore raw

cover pull: various changes, mostly build system related

Hello,

Here is my next random collection of various small changes here and there in source tree. Many of the changes has relation to build system, and the remainign one are reactions to compiler complaints found after build system teaks. I hope these changes are reviewed before next release, and in best case they might even be part of it.

----------------------------------------------------------------
The following changes since commit 41c54e81145a0f35c2bd576a0ee57c3844dee710:

allow none-ncurses messaging with ui_notify_user() (2014-09-29 11:34:25 -0700)

are available in the git repository at:

git://github.com/kerolasa/powertop.git various

for you to fetch changes up to e6663e420abb526523fa1a7fda42661801480155:

add missing include (2014-10-25 11:16:36 +0100)
----------------------------------------------------------------
Sami Kerola (14):
configure: require the least automake version 1.11.1
configure: use autoconf-archive ax_pthread.m4
add missing space to --version print out
csstoh.sh: check every single return value
configure: use AC_USE_SYSTEM_EXTENSIONS to determine features powertop.m4: GCC_FORTIFY_SOURCE_CC copy idea of macro from Archlinux
pacman
configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4
main: fix incompatible operand type
move variables to protected scope
make --quiet option to suppress various info messages squeeze all extra bits from size of binary and html report add timestamp to html report
fix typo in message
add missing include

 .gitignore                           |  39 +++-
 PowerTop.png                         | Bin 6975 -> 5542 bytes
 configure.ac                         |  21 ++-
 m4/ax_cxx_compile_stdcxx_11.m4       | 142 +++++++++++++++
 m4/ax_pthread.m4                     | 332 +++++++++++++++++++++++++++++++++++
 m4/gcc_fortify_source_cc.m4          |  29 +++
 src/Makefile.am                      |   1 -
 src/cpu/rapl/rapl_interface.cpp      |   7 +-
 src/cpu/rapl/rapl_interface.h        |   9 +-
 src/csstoh.sh                        |  40 +++--
 src/lib.h                            |   1 +
 src/main.cpp                         |   8 +-
 src/report/report-formatter-base.cpp |   2 -
 src/report/report-formatter-csv.cpp  |   2 -
 src/report/report-formatter-html.cpp | 248 +++++++++++++-------------
 src/report/report.cpp                |   5 +-
 16 files changed, 719 insertions(+), 167 deletions(-)
 create mode 100644 m4/ax_cxx_compile_stdcxx_11.m4
 create mode 100644 m4/ax_pthread.m4
 create mode 100644 m4/gcc_fortify_source_cc.m4
Signature · 1 line
2.1.2
author
#1 lore raw

PATCH 1/14 configure: require the least automake version 1.11.1

Reported-by Andreas Mohr <andi(a)lisas.de>
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure.ac +5 -1
index 4991d97..c3f5666 100644
@@ -3,7 +3,11 @@
 
 AC_PREREQ([2.68])
 AC_INIT([powertop], [2.6.1], [powertop(a)lists.01.org], [], [https://01.org/powertop])
-AM_INIT_AUTOMAKE([-Wall foreign])
+AM_INIT_AUTOMAKE([
+	-Wall
+	1.11.1
+	foreign
+])
 AC_LANG([C++])
 AC_CONFIG_FILES([
 	Makefile
Signature · 1 line
2.1.2
author
#2 lore raw

PATCH 2/14 configure: use autoconf-archive ax_pthread.m4

In reply to Sami Kerola

The configuration script "AX_PTHREAD" was added to the build specification so that corresponding special parameters will be taken into account.

Reference: http://www.gnu.org/software/autoconf-archive/ax_pthread.html
Reviewed-by: SF Markus Elfring <elfring(a)users.sourceforge.net>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
Signed-off-by: Sami Kerola <kerolasa(a)iki.fi>

---
 .gitignore       |  39 ++++++-
 configure.ac     |  11 +-
 m4/ax_pthread.m4 | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 376 insertions(+), 6 deletions(-)
 create mode 100644 m4/ax_pthread.m4
.gitignore +36 -3
index b9188a1..f879840 100644
@@ -13,9 +13,6 @@
 Makefile
 Makefile.in
 
-# directories
-/m4/
-
 # individual files
 /ABOUT-NLS
 /ChangeLog
@@ -35,6 +32,42 @@ Makefile.in
 /install-sh
 /libtool
 /ltmain.sh
+/m4/codeset.m4
+/m4/fcntl-o.m4
+/m4/gettext.m4
+/m4/glibc2.m4
+/m4/glibc21.m4
+/m4/iconv.m4
+/m4/intdiv0.m4
+/m4/intl.m4
+/m4/intldir.m4
+/m4/intlmacosx.m4
+/m4/intmax.m4
+/m4/inttypes-pri.m4
+/m4/inttypes_h.m4
+/m4/lcmessage.m4
+/m4/lib-ld.m4
+/m4/lib-link.m4
+/m4/lib-prefix.m4
+/m4/libtool.m4
+/m4/lock.m4
+/m4/longlong.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
+/m4/lt~obsolete.m4
+/m4/nls.m4
+/m4/po.m4
+/m4/printf-posix.m4
+/m4/progtest.m4
+/m4/size_max.m4
+/m4/stdint_h.m4
+/m4/threadlib.m4
+/m4/uintmax_t.m4
+/m4/visibility.m4
+/m4/wchar_t.m4
+/m4/wint_t.m4
+/m4/xsize.m4
 /missing
 /po/Makevars.template
 /po/POTFILES
configure.ac +8 -3
index c3f5666..27e52ad 100644
@@ -35,6 +35,14 @@ AC_PROG_INSTALL
 AM_PROG_CC_C_O
 
 # Checks for libraries.
+AX_PTHREAD([
+    LIBS="$PTHREAD_LIBS $LIBS"
+    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+    CC="$PTHREAD_CC"
+  ], [
+    AC_MSG_ERROR([Could not configure pthreads support])
+])
+
 # Checks for header files.
 AC_CHECK_HEADERS([ \
 	fcntl.h \
@@ -132,9 +140,6 @@ AS_IF([test "$has_libpci" -eq 0], [
 	])
 ])
 
-AC_SEARCH_LIBS([pthread_create], [pthread], [], [
-	AC_MSG_ERROR([libpthread is required but was not found])
-], [])
 AC_SEARCH_LIBS([inet_aton], [resolv], [], [
 	AC_MSG_ERROR([libresolv is required but was not found])
 ], [])
m4/ax_pthread.m4 new file +332 -0

332 lines not on this page · raw message

Signature · 1 line
2.1.2
author
#3 lore raw

PATCH 3/14 add missing space to --version print out

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +1 -1
index d3963ed..6e56d8e 100644
@@ -96,7 +96,7 @@ static const struct option long_options[] =
 
 static void print_version()
 {
-	printf(_("PowerTOP version" POWERTOP_VERSION ", compiled on " __DATE__ "\n"));
+	printf(_("PowerTOP version " POWERTOP_VERSION ", compiled on " __DATE__ "\n"));
 }
 
 static bool set_refresh_timeout()
Signature · 1 line
2.1.2
author
#4 lore raw

PATCH 4/14 csstoh.sh: check every single return value

In reply to Sami Kerola

Earlier the script continued processing at errors.

$ ./csstoh.sh powertop.css /dev/full
./csstoh.sh: line 36: echo: write error: No space left on device
./csstoh.sh: line 37: echo: write error: No space left on device
[...]

Now the script will fail immediately when an error occurs.

$ ./csstoh.sh powertop.css /dev/full ; echo $?
cat: write error: No space left on device
1

As a minor improvement the script now writes errors to stderr rather than stdout, that is more appropriate.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/csstoh.sh | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)
src/csstoh.sh +23 -17
index 9d4100b..4ba70e2 100755
@@ -18,27 +18,33 @@
 #
 # Written by Igor Zhbanov <i.zhbanov at samsung.com>
 
-if [ $# -lt 2 ]; then
-	echo "Usage: csstoh.sh cssfile header.h"
+if [ $# -ne 2 ]; then
+	echo "Usage: csstoh.sh cssfile header.h" >&2
 	exit 1
 fi
-
-if [ ! -r $1 ]; then
-	echo "Can't find file $1"
-	exit 1
-fi
-
-if ! echo -n >$2; then
-	echo "Can't open file $2 for writing."
+if [ ! -f "$1" ]; then
+	echo "$1: no such file or directory" >&2
 	exit 1
 fi
+# redirect stdout to a file
+exec 1> "$2" || exit $?
 
-echo "#ifndef __INCLUDE_GUARD_CCS_H" >> $2
-echo "#define __INCLUDE_GUARD_CCS_H" >> $2
-echo >> $2
-echo "const char css[] = " >> $2
+# header
+cat <<HERE || exit $?
+#ifndef __INCLUDE_GUARD_CCS_H
+#define __INCLUDE_GUARD_CCS_H
 
-sed -r 's/^(.*)$/\t\"\1\\n\"/' $1 >> $2
+const char css[] = 
+HERE
+# body
+sed -r 's/^(.*)$/\t\"\1\\n\"/' "$1" || exit $?
+# footer
+cat <<HERE || exit $?
+;
+#endif
+HERE
 
-echo ";" >> $2
-echo "#endif" >> $2
+# close output file
+exec 1>&-
+# return status of output file write
+exit $?
Signature · 1 line
2.1.2
author
#5 lore raw

PATCH 5/14 configure: use AC_USE_SYSTEM_EXTENSIONS to determine features

In reply to Sami Kerola

The AC_USE_SYSTEM_EXTENSIONS will enable everything that a system allows to be enabled, so there is no longer need for a source file specific *_SOURCE definitions. Secondly the uses of _BSD_SOURCE that are removed in this change are part of deprecated API. See reference link for details.

Reference: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=c941736c92fa3a319221f65f6755659b2a5e0a20
Signed-off-by: Sami Kerola <kerolasa(a)iki.fi>

---
 configure.ac                         | 1 +
 src/report/report-formatter-base.cpp | 2 --
 src/report/report-formatter-csv.cpp  | 2 --
 src/report/report-formatter-html.cpp | 2 --
 4 files changed, 1 insertion(+), 6 deletions(-)
configure.ac +1 -0
index 27e52ad..dc376ce 100644
@@ -18,6 +18,7 @@ AC_CONFIG_FILES([
 ])
 AC_CONFIG_SRCDIR([src/main.cpp])
 AC_CONFIG_MACRO_DIR([m4])
+AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_HEADERS([config.h])
 GETTEXT_PACKAGE=powertop
 AC_SUBST([GETTEXT_PACKAGE])
src/report/report-formatter-base.cpp +0 -2
index 7c5159e..4e10603 100644
@@ -23,8 +23,6 @@
  * Written by Igor Zhbanov <i.zhbanov(a)samsung.com>
  * 2012.10 */
 
-#define _BSD_SOURCE
-
 /* Uncomment to disable asserts */
 /*#define NDEBUG*/
 
src/report/report-formatter-csv.cpp +0 -2
index 523e79b..0360fd8 100644
@@ -23,8 +23,6 @@
  * Written by Igor Zhbanov <i.zhbanov(a)samsung.com>
  * 2012.10 */
 
-#define _BSD_SOURCE
-
 /* Uncomment to disable asserts */
 /*#define NDEBUG*/
 
src/report/report-formatter-html.cpp +0 -2
index 3803962..41440f9 100644
@@ -23,8 +23,6 @@
  * Written by Igor Zhbanov <i.zhbanov(a)samsung.com>
  * 2012.10 */
 
-#define _BSD_SOURCE
-
 /* Uncomment to disable asserts */
 /*#define NDEBUG*/
 
Signature · 1 line
2.1.2
author
#6 lore raw

PATCH 6/14 powertop.m4: GCC_FORTIFY_SOURCE_CC copy idea of macro from Archlinux pacman

In reply to Sami Kerola

The powertop.m4 is a collection file for autoconf m4 helper macros, such as GCC_FORTIFY_SOURCE_CC. The macro in case will define feature _FORTIFY_SOURCE=2 when it is possible, instead of trying to enable when it will not work, such as at times when optimization is turned off.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac                |  2 ++
 m4/gcc_fortify_source_cc.m4 | 29 +++++++++++++++++++++++++++++
 src/Makefile.am             |  1 -
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 m4/gcc_fortify_source_cc.m4
configure.ac +2 -0
index dc376ce..e56a451 100644
@@ -34,6 +34,7 @@ AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_INSTALL
 AM_PROG_CC_C_O
+GCC_FORTIFY_SOURCE_CC
 
 # Checks for libraries.
 AX_PTHREAD([
@@ -145,4 +146,5 @@ AC_SEARCH_LIBS([inet_aton], [resolv], [], [
 	AC_MSG_ERROR([libresolv is required but was not found])
 ], [])
 
+
 AC_OUTPUT
m4/gcc_fortify_source_cc.m4 new file +29 -0
new file mode 100644
index 0000000..1206672
@@ -0,0 +1,29 @@
+dnl GCC_FORTIFY_SOURCE_CC
+dnl checks -D_FORTIFY_SOURCE with the C++ compiler, if it exists then
+dnl updates CXXCPP
+AC_DEFUN([GCC_FORTIFY_SOURCE_CC],[
+  AC_LANG_ASSERT([C++])
+  AS_IF([test "X$CXX" != "X"], [
+    AC_MSG_CHECKING([for FORTIFY_SOURCE support])
+    fs_old_cxxcpp="$CXXCPP"
+    fs_old_cxxflags="$CXXFLAGS"
+    CXXCPP="$CXXCPP -D_FORTIFY_SOURCE=2"
+    CXXFLAGS="$CXXFLAGS -Werror"
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[]], [[
+        int main(void) {
+        #if !(__GNUC_PREREQ (4, 1) )
+        #error No FORTIFY_SOURCE support
+        #endif
+          return 0;
+        }
+      ]], [
+        AC_MSG_RESULT([yes])
+      ], [
+        AC_MSG_RESULT([no])
+        CXXCPP="$fs_old_cxxcpp"
+      ])
+    ])
+    CXXFLAGS="$fs_old_cxxflags"
+  ])
+])
src/Makefile.am +0 -1
index 311b75e..bb2b369 100644
@@ -134,7 +134,6 @@ powertop_CXXFLAGS = \
 
 powertop_CPPFLAGS = \
 	-DLOCALEDIR=\"$(localedir)\" \
-	-D_FORTIFY_SOURCE=2 \
 	$(GLIB2_CFLAGS) \
 	$(LIBNL_CFLAGS) \
 	$(LIBZ_CFLAGS) \
Signature · 1 line
2.1.2
author
#7 lore raw

PATCH 7/14 configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4

In reply to Sami Kerola

Ensure the C++11 is supported, and fail when it is not.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac                   |   1 +
 m4/ax_cxx_compile_stdcxx_11.m4 | 142 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+)
 create mode 100644 m4/ax_cxx_compile_stdcxx_11.m4
configure.ac +1 -0
index e56a451..b4460fb 100644
@@ -35,6 +35,7 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AM_PROG_CC_C_O
 GCC_FORTIFY_SOURCE_CC
+AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
 
 # Checks for libraries.
 AX_PTHREAD([
m4/ax_cxx_compile_stdcxx_11.m4 new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
2.1.2
#8 lore raw

Re: [Powertop] [PATCH 07/14] configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4

Quoted 1 line · Sami Kerola

Ensure the C++11 is supported, and fail when it is not.

While I would love to be able to use features from C++11 in powertop I was under the impression that only C++98 was required, what are the facts regarding that?

/MF

author
#9 lore raw

Re: [Powertop] [PATCH 07/14] configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4

Quoted 6 lines · Magnus Fromreide
Quoted 1 line · Sami Kerola

Ensure the C++11 is supported, and fail when it is not.

While I would love to be able to use features from C++11 in powertop I was under the impression that only C++98 was required, what are the facts regarding that?

Looking compiler warnings the C++11 is needed.

./../traceevent/event-parse.h:468:18: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:469:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:482:18: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:483:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:484:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:485:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:498:18: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:499:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:500:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:501:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:502:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:503:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:504:13: warning: use of C++11 long long integer constant [-Wlong-long] ./../traceevent/event-parse.h:505:13: warning: use of C++11 long long integer constant [-Wlong-long] process/do_process.cpp:482:13: warning: use of C++11 long long integer constant [-Wlong-long]
process/do_process.cpp:528:13: warning: use of C++11 long long integer constant [-Wlong-long]
process/do_process.cpp:575:13: warning: use of C++11 long long integer constant [-Wlong-long]
process/do_process.cpp:680:17: warning: use of C++11 long long integer constant [-Wlong-long]
process/timer.cpp:83:11: warning: use of C++11 long long integer constant [-Wlong-long]
process/work.cpp:60:11: warning: use of C++11 long long integer constant [-Wlong-long]

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
author
#10 lore raw

PATCH 8/14 main: fix incompatible operand type

In reply to Sami Kerola

main.cpp:430:35: error: incompatible operand types ('char *' and 'char')

                        sprintf(workload, "%s", optarg ? optarg : '\0');
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +1 -1
index 6e56d8e..9471bcc 100644
@@ -427,7 +427,7 @@ int main(int argc, char **argv)
 			time_out = (optarg ? atoi(optarg) : 20);
 			break;
 		case 'w':		/* measure workload */
-			sprintf(workload, "%s", optarg ? optarg : '\0');
+			sprintf(workload, "%s", optarg ? optarg : "");
 			break;
 		case 'V':
 			print_version();
Signature · 1 line
2.1.2
author
#11 lore raw

PATCH 9/14 move variables to protected scope

In reply to Sami Kerola

This fixes series of issues reported by clang++ compiler the same way.

cpu/rapl/rapl_interface.h:37:6: error: private field 'measurment_interval' is not used [-Werror,-Wunused-private-field]

        int measurment_interval;
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/cpu/rapl/rapl_interface.cpp | 2 +-
 src/cpu/rapl/rapl_interface.h   | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
src/cpu/rapl/rapl_interface.cpp +1 -1
index ab8e8ce..2fc55b1 100644
@@ -75,8 +75,8 @@ c_rapl_interface::c_rapl_interface(const char *dev_name, int cpu) :
 	powercap_core_path(),
 	powercap_uncore_path(),
 	powercap_dram_path(),
-	measurment_interval(def_sampling_interval),
 	first_cpu(cpu),
+	measurment_interval(def_sampling_interval),
 	last_pkg_energy_status(0.0),
 	last_dram_energy_status(0.0),
 	last_pp0_energy_status(0.0),
src/cpu/rapl/rapl_interface.h +5 -4
index 744f595..c8e9683 100644
@@ -34,21 +34,22 @@ private:
 	string powercap_dram_path;
 
 	unsigned char rapl_domains;
-	int measurment_interval;
 	int first_cpu;
 
 	double power_units;
 	double energy_status_units;
 	double time_units;
 
+	int read_msr(int cpu, unsigned int idx, uint64_t *val);
+	int write_msr(int cpu, unsigned int idx, uint64_t val);
+
+protected:
+	int measurment_interval;
 	double last_pkg_energy_status;
 	double last_dram_energy_status;
 	double last_pp0_energy_status;
 	double last_pp1_energy_status;
 
-	int read_msr(int cpu, unsigned int idx, uint64_t *val);
-	int write_msr(int cpu, unsigned int idx, uint64_t val);
-
 public:
 	c_rapl_interface(const char *dev_name = "package-0", int cpu = 0);
 
Signature · 1 line
2.1.2
author
#12 lore raw

PATCH 10/14 make --quiet option to suppress various info messages

In reply to Sami Kerola

When --quiet is defined messages such as'RAPL device for cpu 0' and 'Leaving PowerTOP' are not expected to be printed. This change makes them to be printed to stderr, that the --quiet is redirecting to /dev/null.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/cpu/rapl/rapl_interface.cpp | 5 ++---
 src/main.cpp                    | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
src/cpu/rapl/rapl_interface.cpp +2 -3
index 2fc55b1..d6bd4c8 100644
@@ -39,7 +39,7 @@
 #define RAPL_DBG_PRINT(...)	((void) 0)
 #define RAPL_ERROR_PRINT(...) ((void) 0)
 #endif
-#define RAPL_INFO_PRINT printf
+#define RAPL_INFO_PRINT(format, m) fprintf(stderr, format, m)
 
 #define MAX_TEMP_STR_SIZE	20
 
@@ -134,8 +134,7 @@ c_rapl_interface::c_rapl_interface(const char *dev_name, int cpu) :
 			closedir(dir);
 		}
 
-		RAPL_INFO_PRINT("RAPL Using PowerCap Sysfs : Domain Mask %x\n",
-														rapl_domains);
+		RAPL_INFO_PRINT("RAPL Using PowerCap Sysfs : Domain Mask %x\n", rapl_domains);
 		return;
 	}
 
src/main.cpp +1 -1
index 9471bcc..94c2a6b 100644
@@ -483,7 +483,7 @@ int main(int argc, char **argv)
 	}
 	if (!auto_tune)
 		endwin();
-	printf("%s\n", _("Leaving PowerTOP"));
+	fprintf(stderr, "%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
 	clear_process_data();
Signature · 1 line
2.1.2
author
#13 lore raw

PATCH 11/14 squeeze all extra bits from size of binary and html report

In reply to Sami Kerola

This change makes the css text smaller by removing unnecessary leading white spaces, and the logo got 'pngcrush -brute' treatment.

-rw-r--r-- 1 root root 62722 Oct 20 22:12 before.html -rw-r--r-- 1 root root 60224 Oct 20 22:13 after.html

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 PowerTop.png                         | Bin 6975 -> 5542 bytes
 src/csstoh.sh                        |   2 +-
 src/report/report-formatter-html.cpp | 246 +++++++++++++++++------------------
 3 files changed, 124 insertions(+), 124 deletions(-)
PowerTop.png binary +0 -0
index d8474107f189549d45cf854db5c801ffd935dbb9..838272b08f5a222684ec8fbc309781176bb445c0 100644
GIT binary patch
src/csstoh.sh +1 -1
index 4ba70e2..53c465c 100755
@@ -37,7 +37,7 @@ cat <<HERE || exit $?
 const char css[] = 
 HERE
 # body
-sed -r 's/^(.*)$/\t\"\1\\n\"/' "$1" || exit $?
+sed -r 's/^[ \t]*//; s/^(.*)$/\t\"\1\\n\"/' "$1" || exit $?
 # footer
 cat <<HERE || exit $?
 ;
src/report/report-formatter-html.cpp +123 -123

252 lines not on this page · raw message

Signature · 1 line
2.1.2
author
#14 lore raw

PATCH 12/14 add timestamp to html report

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/report/report.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/report/report.cpp +4 -1
index 981e984..cd3c961 100644
@@ -101,6 +101,8 @@ static string read_os_release(const string &filename)
 static void system_info(void)
 {
 	string str;
+	char version_date[64];
+	time_t now = time(NULL);
 
 	/* div attr css_class and css_id */
 	tag_attr div_attr;
@@ -117,7 +119,8 @@ static void system_info(void)
 	/* Set array of data in row Major order */
 	string *system_data = new string[sys_table.rows * sys_table.cols];
 	system_data[0]=__("PowerTOP Version");
-	system_data[1]=POWERTOP_VERSION;
+	snprintf(version_date, sizeof(version_date), "%s ran at %s", POWERTOP_VERSION, ctime(&now));
+	system_data[1]=version_date;
 
 	str = read_sysfs_string("/proc/version");
 	size_t  found = str.find(" ");
Signature · 1 line
2.1.2
author
#15 lore raw

PATCH 13/14 fix typo in message

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +1 -1
index 94c2a6b..0c8aa80 100644
@@ -421,7 +421,7 @@ int main(int argc, char **argv)
 			break;
 		case 'q':
 			if (freopen("/dev/null", "a", stderr))
-				fprintf(stderr, _("Quite mode failed!\n"));
+				fprintf(stderr, _("Quiet mode failed!\n"));
 			break;
 		case 't':
 			time_out = (optarg ? atoi(optarg) : 20);
Signature · 1 line
2.1.2
author
#16 lore raw

PATCH 14/14 add missing include

In reply to Sami Kerola

In file included from measurement/sysfs.cpp:27:
In file included from measurement/../lib.h:59:
In file included from /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.1/../../../../include/c++/4.9.1/string:52:
In file included from /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.1/../../../../include/c++/4.9.1/bits/basic_string.h:2850:
In file included from /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.1/../../../../include/c++/4.9.1/ext/string_conversions.h:41:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.1/../../../../include/c++/4.9.1/cstdlib:153:11: error:
no member named 'realloc' in the global namespace

  using ::realloc;
        ~~^
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/lib.h | 1 +
 1 file changed, 1 insertion(+)
src/lib.h +1 -0
index ec50946..5c94271 100644
@@ -27,6 +27,7 @@
 
 #include <libintl.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 /* Include only for Automake builds */
 #ifdef HAVE_CONFIG_H
Signature · 1 line
2.1.2
#17 lore raw
In reply to Sami Kerola

Hi Sami,

Quoted 63 lines

Hello,

Here is my next random collection of various small changes here and there in source tree. Many of the changes has relation to build system, and the remainign one are reactions to compiler complaints found after build system teaks. I hope these changes are reviewed before next release, and in best case they might even be part of it.

----------------------------------------------------------------
The following changes since commit
41c54e81145a0f35c2bd576a0ee57c3844dee710:

allow none-ncurses messaging with ui_notify_user() (2014-09-29 11:34:25
-0700)

are available in the git repository at:

git://github.com/kerolasa/powertop.git various

for you to fetch changes up to e6663e420abb526523fa1a7fda42661801480155:

add missing include (2014-10-25 11:16:36 +0100)
----------------------------------------------------------------
Sami Kerola (14):
configure: require the least automake version 1.11.1
configure: use autoconf-archive ax_pthread.m4
add missing space to --version print out
csstoh.sh: check every single return value
configure: use AC_USE_SYSTEM_EXTENSIONS to determine features powertop.m4: GCC_FORTIFY_SOURCE_CC copy idea of macro from Archlinux
pacman
configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4
main: fix incompatible operand type
move variables to protected scope
make --quiet option to suppress various info messages squeeze all extra bits from size of binary and html report add timestamp to html report
fix typo in message
add missing include

 .gitignore                           |  39 +++-
 PowerTop.png                         | Bin 6975 -> 5542 bytes
 configure.ac                         |  21 ++-
 m4/ax_cxx_compile_stdcxx_11.m4       | 142 +++++++++++++++
 m4/ax_pthread.m4                     | 332
+++++++++++++++++++++++++++++++++++
 m4/gcc_fortify_source_cc.m4          |  29 +++
 src/Makefile.am                      |   1 -
 src/cpu/rapl/rapl_interface.cpp      |   7 +-
 src/cpu/rapl/rapl_interface.h        |   9 +-
 src/csstoh.sh                        |  40 +++--
 src/lib.h                            |   1 +
 src/main.cpp                         |   8 +-
 src/report/report-formatter-base.cpp |   2 -
 src/report/report-formatter-csv.cpp  |   2 -
 src/report/report-formatter-html.cpp | 248 +++++++++++++-------------
 src/report/report.cpp                |   5 +-
 16 files changed, 719 insertions(+), 167 deletions(-)
 create mode 100644 m4/ax_cxx_compile_stdcxx_11.m4
 create mode 100644 m4/ax_pthread.m4
 create mode 100644 m4/gcc_fortify_source_cc.m4
Quoted 8 lines

--
2.1.2

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

Keep in mind that for PowerTOP patches there is a turnaround cycle of about two weeks give and take. This gives the maintainer and the community time to check your work.

Here is my first pass for your patches:

3, 4, 5, 6, 8, 10, 11, 12, 13, 14: At glance look good. They need testing.

1: Require at least automake 1.12.2 to avoid exploitable issues with earlier versions.

9: Looks good. However, what is the object of moving measurment_interval(def_sampling_interval) to be after first_cpu(cpu)?

2: Please explain what is the difference from what we have to what you propose?

7: This one makes no sense as-is. Please update the commit message explaining why the patch is necessary. As far as I can tell from the PowerTOP source code, it doesn't use C++11, so I don't understand why it would be necessary to fail.

Thank you,
Alexandra.

author
#18 lore raw

On 31 October 2014 23:07, Alexandra Yates
<alexandra.yates(a)linux.intel.com> wrote:

Hi Alexandra, et.al.,

Quoted 3 lines

Keep in mind that for PowerTOP patches there is a turnaround cycle of about two weeks give and take. This gives the maintainer and the community time to check your work.

ACK.

Looking the PowerTop 2.7 release planning changes in this patch set are unlikely to be part of the release. Please mention if you would like to see these changes in 2.7, so that I can hurry up with possible extra changes.

Quoted 3 lines

Here is my first pass for your patches:

3, 4, 5, 6, 8, 10, 11, 12, 13, 14: At glance look good. They need testing.

0003-add-missing-space-to-version-print-out.patch 0004-csstoh.sh-check-every-single-return-value.patch 0005-configure-use-AC_USE_SYSTEM_EXTENSIONS-to-determine-.patch 0006-powertop.m4-GCC_FORTIFY_SOURCE_CC-copy-idea-of-macro.patch

0008-main-fix-incompatible-operand-type.patch

0010-make-quiet-option-to-suppress-various-info-messages.patch 0011-squeeze-all-extra-bits-from-size-of-binary-and-html-.patch 0012-add-timestamp-to-html-report.patch 0013-fix-typo-in-message.patch 0014-add-missing-include.patch

Quoted 2 lines

1: Require at least automake 1.12.2 to avoid exploitable issues with earlier versions.

0001-configure-require-the-least-automake-version-1.11.1.patch

Thank you for mentioning the CVE fix. I'll make autoconf to require that version.

Notice that the request to split m4 directories

https://lists.01.org/pipermail/powertop/2014-October/001639.html

will makes dependency to AC_CONFIG_MACRO_DIR that is supported in automake 1.13 and added to autoconf that is not yet released.

http://git.savannah.gnu.org/cgit/automake.git/tree/NEWS#n640
http://git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS#n40

Are you absolutely sure splitting generated and projects own m4 data to different directories is worth of requiring very latest & upstream versions?

Quoted 2 lines

9: Looks good. However, what is the object of moving measurment_interval(def_sampling_interval) to be after first_cpu(cpu)?

0009-move-variables-to-protected-scope.patch

The function is moved because of an ordering issue reported by clang++.

make[3]: Entering directory '/home/src/powertop/src'
CXX cpu/rapl/powertop-rapl_interface.o
cpu/rapl/rapl_interface.cpp:78:2: warning: field 'measurment_interval' will be initialized after field 'first_cpu' [-Wreorder]
measurment_interval(def_sampling_interval),

I added that to v2 commit message.

Quoted 2 lines

2: Please explain what is the difference from what we have to what you propose?

Markus Elfring proposed the change, I simply implemented the proposal. Here is his justification.

https://lists.01.org/pipermail/powertop/2014-October/001643.html

I will keep the change as part of patch set until it is merged or clearly rejected.

Quoted 4 lines

7: This one makes no sense as-is. Please update the commit message explaining why the patch is necessary. As far as I can tell from the PowerTOP source code, it doesn't use C++11, so I don't understand why it would be necessary to fail.

I see, the message could have been a bit more verbose. Let me rephrase, and keep the change part of submission at least for now.

-- snip

Executive summary: The resubmitted v2 patch set is unlikely final version. I am guessing v3 will end up dropping all m4 related changes:
0002, 0006, and 0007.

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/