Skip to contentSkip to conversation

pull: various changes, mostly build system related

PATCH In review Sami Kerola 2 participants 17 messages Nov 25, 2014

lore
Share & tools
lore

Sami Kerola

author
#0 lore raw

v3 cover pull: various changes, mostly build system related

This times includes a fix to white space issue reported by checkpatch.pl

ERROR: trailing whitespace

    14 #139: FILE: src/csstoh.sh:37:
    15 +const char css[] = $

And the conflict after version number update in configure.ac is removed, plus one new patch that makes textual correction to a information message.

Sami Kerola (15):
configure: require new enough automake version
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
textual: add new line to a message

 .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/parameters/parameters.cpp        |   2 +-
 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 +-
 17 files changed, 720 insertions(+), 168 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.3
author
#1 lore raw

PATCH v3 1/15 configure: require new enough automake version

Andreas had build issues with older than 1.11 automake, and it seemed like 1.11.1 would good required version until Alexandra pointed out that 1.12.2 is needed to be safe from CVE-2012-3386 vulnerability.

Reported-by: Andreas Mohr <andi(a)lisas.de>
Reported-by: Alexandra Yates <alexandra.yates(a)linux.intel.com>
Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-3386
Signed-off-by: Sami Kerola <kerolasa(a)iki.fi>

---
 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure.ac +5 -1
index 3756671..7ab763f 100644
@@ -3,7 +3,11 @@
 
 AC_PREREQ([2.68])
 AC_INIT([powertop], [2.7], [powertop(a)lists.01.org], [], [https://01.org/powertop])
-AM_INIT_AUTOMAKE([-Wall foreign])
+AM_INIT_AUTOMAKE([
+	-Wall
+	1.12.2
+	foreign
+])
 AC_LANG([C++])
 AC_CONFIG_FILES([
 	Makefile
Signature · 1 line
2.1.3
author
#2 lore raw

PATCH v3 2/15 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 7ab763f..40f3eaf 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.3
author
#3 lore raw

PATCH v3 3/15 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 642ac24..6130732 100644
@@ -97,7 +97,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.3
author
#4 lore raw

PATCH v3 4/15 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.

Quoted 1 line

From https://lists.01.org/pipermail/powertop/2014-November/001686.html

Removal of white space error.

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..3b46d85 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.3
author
#5 lore raw

PATCH v3 5/15 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 40f3eaf..1859553 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.3
author
#6 lore raw

PATCH v3 6/15 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 1859553..b9ee05a 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 d2f1da7..0bccdb4 100644
@@ -135,7 +135,6 @@ powertop_CXXFLAGS = \
 
 powertop_CPPFLAGS = \
 	-DLOCALEDIR=\"$(localedir)\" \
-	-D_FORTIFY_SOURCE=2 \
 	$(GLIB2_CFLAGS) \
 	$(LIBNL_CFLAGS) \
 	$(LIBZ_CFLAGS) \
Signature · 1 line
2.1.3
author
#7 lore raw

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

In reply to Sami Kerola

Ensure the powertop is compiled C++11 compliant compiler. That allows project contributors to use features from the latest standard without hesitation are they allowed in this project. The idea is to grant greater liberties to upstream in cost of a dependency to downstream.

Notice that adding a downstream dependency to C++11 compliant compiler is not outrageously unreasonable. Many of the C++11 features has been supported quite a while. That said use of some features, such as attributes (N2761), may still make maintainers to be unhappy if the case is not justified well enough.

Reference: http://en.cppreference.com/w/cpp/compiler_support
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 b9ee05a..79ea055 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.3
author
#8 lore raw

PATCH v3 8/15 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 6130732..6fdfd54 100644
@@ -442,7 +442,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.3
author
#9 lore raw

PATCH v3 9/15 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;

The measurment_interval() in relation to first_cpu() is moved to avoid following compiler warning.

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),

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.3
author
#10 lore raw

PATCH v3 10/15 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 6fdfd54..b6679f2 100644
@@ -500,7 +500,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.3
author
#11 lore raw

PATCH v3 11/15 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 3b46d85..681e6a5 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.3
author
#12 lore raw

PATCH v3 12/15 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.3
author
#13 lore raw

PATCH v3 13/15 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 b6679f2..dc69fca 100644
@@ -436,7 +436,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.3
author
#14 lore raw

PATCH v3 14/15 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.3
author
#15 lore raw

PATCH v3 15/15 textual: add new line to a message

In reply to Sami Kerola

Earlier message was not quite right as seen below.

$ sudo ./src/powertop --auto
Loaded 244 prior measurements
[...]
To show power estimates do 20 measurement(s) connected to battery onlyLeaving PowerTOP
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/parameters/parameters.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/parameters/parameters.cpp +1 -1
index 1843342..ec119b6 100644
@@ -439,7 +439,7 @@ int global_power_valid(void)
 		return 1;
 
 	if (past_results.size() > 0 && global_run_times < 1){
-		printf("To show power estimates do %ld measurement(s) connected to battery only",
+		printf("To show power estimates do %ld measurement(s) connected to battery only\n",
 			(3 * all_parameters.parameters.size()) - past_results.size());
 		global_run_times += 1; 
 	}
Signature · 1 line
2.1.3
#16 lore raw
In reply to Sami Kerola
Quoted 53 lines

This times includes a fix to white space issue reported by checkpatch.pl

ERROR: trailing whitespace

    14 #139: FILE: src/csstoh.sh:37:
    15 +const char css[] = $

And the conflict after version number update in configure.ac is removed, plus one new patch that makes textual correction to a information message.

Sami Kerola (15):
configure: require new enough automake version
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
textual: add new line to a message

 .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/parameters/parameters.cpp        |   2 +-
 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 +-
 17 files changed, 720 insertions(+), 168 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.3

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

Sami,

Thank you again for submitting your patches.

They were added to up stream today!

Thank you,
Alexandra.