Skip to contentSkip to conversation

configure: use vertical lists

PATCH Superseded Sami Kerola 3 participants 22 messages Aug 5, 2014 – Aug 23, 2014 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sami Kerola

author
#0 lore raw

PATCH 1/14 configure: use vertical lists

Horizontal lists has downside of being managed as a single entry in version control, which makes commits that add and remove items difficult to follow. With vertical lists each entry is managed separately, which is much nicer.

Additionally add project URL to autoconfig init, and pretty print macro expressions to have indentation, and bracing that follows more or less in K&R style.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac | 82 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 67 insertions(+), 15 deletions(-)
configure.ac +67 -15
index 0b02ad2..b41cfb3 100644
@@ -2,15 +2,21 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.68])
-AC_INIT([powertop], [2.6.1], [powertop(a)lists.01.org])
-AM_INIT_AUTOMAKE([-Wall foreign ])
+AC_INIT([powertop], [2.6.1], [powertop(a)lists.01.org], [], [https://01.org/powertop])
+AM_INIT_AUTOMAKE([-Wall foreign])
 AC_LANG([C++])
-AC_CONFIG_FILES([Makefile src/Makefile traceevent/Makefile po/Makefile.in doc/Makefile])
+AC_CONFIG_FILES([
+	Makefile
+	src/Makefile
+	traceevent/Makefile
+	po/Makefile.in
+	doc/Makefile
+])
 AC_CONFIG_SRCDIR([src/main.cpp])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 GETTEXT_PACKAGE=powertop
-AC_SUBST(GETTEXT_PACKAGE)
+AC_SUBST([GETTEXT_PACKAGE])
 AM_SILENT_RULES([yes])
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.18])
@@ -26,7 +32,23 @@ AM_PROG_CC_C_O
 
 # Checks for libraries.
 # Checks for header files.
-AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h malloc.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/statfs.h sys/time.h termios.h unistd.h ncurses.h])
+AC_CHECK_HEADERS([ \
+	fcntl.h \
+	libintl.h \
+	limits.h \
+	locale.h \
+	malloc.h \
+	ncurses.h \
+	stdint.h \
+	stdlib.h \
+	string.h \
+	sys/ioctl.h \
+	sys/socket.h \
+	sys/statfs.h \
+	sys/time.h \
+	termios.h \
+	unistd.h \
+])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -44,20 +66,46 @@ AC_FUNC_MALLOC
 AC_FUNC_MMAP
 AC_FUNC_REALLOC
 AC_FUNC_STRTOD
-AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap pow realpath regcomp select setlocale socket sqrt strcasecmp strchr strdup strerror strncasecmp strstr strtoul strtoull])
+AC_CHECK_FUNCS([ \
+	fdatasync \
+	getpagesize \
+	gettimeofday \
+	memmove \
+	memset \
+	mkdir \
+	munmap \
+	pow \
+	realpath \
+	regcomp \
+	select \
+	setlocale \
+	socket \
+	sqrt \
+	strcasecmp \
+	strchr \
+	strdup \
+	strerror \
+	strncasecmp \
+	strstr \
+	strtoul \
+	strtoull \
+])
 
-PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"],
-	AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), []))
+PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"], [
+	AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], [
+		AC_MSG_ERROR([ncurses is required but was not found])
+	], [])
+])
 
 has_libpci=0
-PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
-	AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0] )])
+PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1], [
+	AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0])
+])
  
 
 has_libnl_ver=0
-# libnl-2 provides only libnl-2.0.pc file, so we check for separate libnl-genl-3.0.pc
-# pkg-config file just for libnl-3.0 case.
-#
+dnl libnl-2 provides only libnl-2.0.pc file, so we check for separate
+dnl libnl-genl-3.0.pc pkg-config file just for libnl-3.0 case.
 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
 	PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
 		PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
@@ -78,7 +126,11 @@ if (test "$has_libpci" -eq 0); then
 	])
 fi
 
-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]), [])
+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])
+], [])
 
 AC_OUTPUT
Signature · 1 line
2.0.4
author
#1 lore raw

PATCH 2/14 configure: prefer AS_IF macro rather than shell if statement

Jumping in between shell and m4 syntaxes makes reading the code more difficult, so stick to m4 when ever possible.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
configure.ac +11 -9
index b41cfb3..4991d97 100644
@@ -108,23 +108,25 @@ dnl libnl-2 provides only libnl-2.0.pc file, so we check for separate
 dnl libnl-genl-3.0.pc pkg-config file just for libnl-3.0 case.
 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
 	PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
-		PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
-if (test "$has_libnl_ver" -eq 0); then
-	AC_MSG_ERROR(libnl and libnl-genl are required but were not found)
-fi
-if (test "$has_libnl_ver" -gt 1); then
+		PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])
+	])
+])
+AS_IF([test "$has_libnl_ver" -eq 0], [
+	AC_MSG_ERROR([libnl and libnl-genl are required but were not found])
+])
+AS_IF([test "$has_libnl_ver" -gt 1], [
 	AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
-fi
+])
 
-if (test "$has_libpci" -eq 0); then 
-	AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported])
+AS_IF([test "$has_libpci" -eq 0], [
+	AC_DEFINE([HAVE_NO_PCI], [1], [Define if pci is not supported])
         AC_MSG_WARN([
 			************* LIBPCI SUPPORT NOT CONFIGURED**************
 			If you need or want pci support, please install libpci 
 			and re-configure PowerTOP. 
 			*********************************************************
 	])
-fi
+])
 
 AC_SEARCH_LIBS([pthread_create], [pthread], [], [
 	AC_MSG_ERROR([libpthread is required but was not found])
Signature · 1 line
2.0.4
author
#2 lore raw

PATCH 3/14 update .gitignore

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index 35d41c2..d00973f 100644
@@ -44,6 +44,7 @@ src/.deps/
 src/Makefile
 src/calibrate/.deps/
 src/cpu/.deps/
+src/cpu/rapl/.deps
 src/devices/.deps/
 src/measurement/.deps/
 src/parameters/.deps/
Signature · 1 line
2.0.4
author
#3 lore raw

PATCH 4/14 clean up Makefile.am files

In reply to Sami Kerola

Use vertical rather than horizontal lists, and get rid of deprecated ACLOCAL_AMFLAGS instruction. The src/Makefile.am source file list also needed sorting, as the items order seemed more or less random.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 Makefile.am     |  14 +++-
 src/Makefile.am | 193 +++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 161 insertions(+), 46 deletions(-)
Makefile.am +11 -3
index f5e466b..c8d0ae2 100644
@@ -1,6 +1,14 @@
 AUTOMAKE_OPTIONS = subdir-objects
-ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = traceevent src po doc
+SUBDIRS = \
+	traceevent \
+	src \
+	po \
+	doc
 
-EXTRA_DIST = README TODO Android.mk COPYING autogen.sh 
+EXTRA_DIST = \
+	README \
+	TODO \
+	Android.mk \
+	COPYING \
+	autogen.sh
src/Makefile.am +150 -43

204 lines not on this page · raw message

Signature · 1 line
2.0.4
author
#4 lore raw

PATCH 5/14 fix clang++ compilation errors

In reply to Sami Kerola

The same error was fixed in multiple files to made clang++ work.

error: variable length array of non-POD element type 'string' (aka 'basic_string<char>')

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/cpu/cpu.cpp            | 18 ++++++++++++------
 src/devices/ahci.cpp       |  3 ++-
 src/devices/device.cpp     |  6 ++++--
 src/devlist.cpp            |  3 ++-
 src/process/do_process.cpp |  9 ++++++---
 src/report/report.cpp      |  3 ++-
 src/tuning/tuning.cpp      | 10 ++++++----
 7 files changed, 34 insertions(+), 18 deletions(-)
src/cpu/cpu.cpp +12 -6
index dbca20c..4e040c1 100644
@@ -479,12 +479,12 @@ void report_display_cpu_cstates(void)
 		/* Tables for PKG, CORE, CPU */
 		pkg_tbl_size.cols=2;
 		pkg_tbl_size.rows= ((cstates_num+1)-LEVEL_HEADER)+1;
-		string pkg_data[pkg_tbl_size.cols * pkg_tbl_size.rows];
+		string *pkg_data = new string[pkg_tbl_size.cols * pkg_tbl_size.rows];
 
 		core_tbl_size.cols=2;
 		core_tbl_size.rows=(cstates_num *_package->children.size())
 				+ _package->children.size();
-		string core_data[core_tbl_size.cols * core_tbl_size.rows];
+		string *core_data = new string[core_tbl_size.cols * core_tbl_size.rows];
 		int num_cpus=0, num_cores=0;
 
 		for (core = 0; core < _package->children.size(); core++) {
@@ -506,7 +506,7 @@ void report_display_cpu_cstates(void)
 		cpu_tbl_size.cols=(2 * (num_cpus / num_cores)) + 1;
 		cpu_tbl_size.rows = ((cstates_num+1-LEVEL_HEADER) * _package->children.size())
 				+ _package->children.size();
-		string cpu_data[cpu_tbl_size.cols * cpu_tbl_size.rows];
+		string *cpu_data = new string[cpu_tbl_size.cols * cpu_tbl_size.rows];
 
 		for (core = 0; core < _package->children.size(); core++) {
 			cpu_data[idx3]="&nbsp;";
@@ -633,6 +633,9 @@ void report_display_cpu_cstates(void)
 		init_cpu_table_attr(&std_table_css, title+1, cpu_tbl_size.rows,
 				cpu_tbl_size.cols);
 		report.add_table(cpu_data, &std_table_css);
+		delete [] pkg_data;
+		delete [] core_data;
+		delete [] cpu_data;
 	}
 	report.end_div();
 }
@@ -688,11 +691,11 @@ void report_display_cpu_pstates(void)
 		/*  Tables for PKG, CORE, CPU */
 		pkg_tbl_size.cols=2;
 		pkg_tbl_size.rows=((pstates_num+1)-LEVEL_HEADER)+2;
-		string pkg_data[pkg_tbl_size.cols * pkg_tbl_size.rows];
+		string *pkg_data = new string[pkg_tbl_size.cols * pkg_tbl_size.rows];
 
 		core_tbl_size.cols=2;
 		core_tbl_size.rows=((pstates_num+2) *_package->children.size());
-		string core_data[core_tbl_size.cols * core_tbl_size.rows];
+		string *core_data = new string[core_tbl_size.cols * core_tbl_size.rows];
 
 		/* PKG */
 		num_cpus=0;
@@ -717,7 +720,7 @@ void report_display_cpu_pstates(void)
 		cpu_tbl_size.cols= (num_cpus/ num_cores) + 1;
 		cpu_tbl_size.rows= (pstates_num+2) * _package->children.size()
 				+ _package->children.size();
-		string cpu_data[cpu_tbl_size.cols * cpu_tbl_size.rows];
+		string *cpu_data = new string[cpu_tbl_size.cols * cpu_tbl_size.rows];
 
 		/* Core */
 		for (core = 0; core < _package->children.size(); core++) {
@@ -818,6 +821,9 @@ void report_display_cpu_pstates(void)
 		init_cpu_table_attr(&std_table_css, title,
 				cpu_tbl_size.rows, cpu_tbl_size.cols);
 		report.add_table(cpu_data, &std_table_css);
+		delete [] pkg_data;
+		delete [] core_data;
+		delete [] cpu_data;
 	}
 	report.end_div();
 }
src/devices/ahci.cpp +2 -1
index 3b4627a..a0891ae 100644
@@ -382,7 +382,7 @@ void ahci_create_device_stats_table(void)
 
 
 	/* Set array of data in row Major order */
-	string ahci_data[cols * rows];
+	string *ahci_data = new string[cols * rows];
 	ahci_data[0]=__("Link");
 	ahci_data[1]=__("Active");
 	ahci_data[2]=__("Partial");
@@ -396,6 +396,7 @@ void ahci_create_device_stats_table(void)
 	report.add_title(&title_attr, __("AHCI ALPM Residency Statistics"));
 	report.add_table(ahci_data, &std_table_css);
 	report.end_div();
+	delete [] ahci_data;
 }
 
 void ahci::report_device_stats(string *ahci_data, int idx)
src/devices/device.cpp +4 -2
index da595a8..b4765ef 100644
@@ -247,7 +247,7 @@ void show_report_devices(void)
 
 	/* Device Summary */
 	int summary_size=2;
-        string summary[summary_size];
+	string *summary = new string[summary_size];
 	pw = global_joules_consumed();
 	char buf[32];
 	if (pw > 0.0001) {
@@ -263,9 +263,10 @@ void show_report_devices(void)
 		summary[1].append(" W");
 		report.add_summary_list(summary, summary_size);
 	}
+	delete [] summary;
 
         /* Set array of data in row Major order */
-	string device_data[cols * rows];
+	string *device_data = new string[cols * rows];
 	device_data[0]= __("Usage");
 	device_data[1]= __("Device Name");
 	if (show_power)
@@ -308,6 +309,7 @@ void show_report_devices(void)
 	/* Report Output */
 	report.add_title(&title_attr, __("Device Power Report"));
 	report.add_table(device_data, &std_table_css);
+	delete [] device_data;
 }
 
 
src/devlist.cpp +2 -1
index 21b4c1c..20fe5da 100644
@@ -326,7 +326,7 @@ void report_show_open_devices(void)
 	init_title_attr(&title_attr);
 
 	/* Set array of data in row Major order */
-	string process_data[cols * rows];
+	string *process_data = new string[cols * rows];
 
 	sort(target->begin(), target->end(), devlist_sort);
 	process_data[0]=__("Process");
@@ -348,5 +348,6 @@ void report_show_open_devices(void)
 	/* No div attribute here inherits from device power report */
 	report.add_title(&title_attr, __("Process Device Activity"));
 	report.add_table(process_data, &std_table_css);
+	delete [] process_data;
 	report.end_div();
 }
src/process/do_process.cpp +6 -3
index f7f9765..8d55507 100644
@@ -918,7 +918,7 @@ void report_process_update_display(void)
 	init_title_attr(&title_attr);
 
 	/* Set array of data in row Major order */
-	string  software_data[cols * rows];
+	string *software_data = new string[cols * rows];
 	software_data[0]=__("Usage");
 	software_data[1]=__("Wakeups/s");
 	software_data[2]=__("GPU ops/s");
@@ -1013,6 +1013,7 @@ void report_process_update_display(void)
 	report.add_title(&title_attr, __("Overview of Software Power Consumers"));
 	report.add_table(software_data, &std_table_css);
         report.end_div();
+	delete [] software_data;
 }
 
 void report_summary(void)
@@ -1048,7 +1049,7 @@ void report_summary(void)
 
 	/* Set array for summary */
 	int summary_size =12;
-	string summary[summary_size];
+	string *summary = new string [summary_size];
 	summary[0]=__("Target:");
 	summary[1]=__("1 units/s");
 	summary[2]=__("System: ");
@@ -1068,7 +1069,7 @@ void report_summary(void)
 	summary[11].append(__(" ops/s"));
 
 	/* Set array of data in row Major order */
-	string summary_data[cols * (rows+1)];
+	string *summary_data = new string[cols * (rows + 1)];
 	summary_data[0]=__("Usage");
 	summary_data[1]=__("Events/s");
 	summary_data[2]=__("Category");
@@ -1134,6 +1135,8 @@ void report_summary(void)
 	report.add_title(&title_attr, __("Top 10 Power Consumers"));
 	report.add_table(summary_data, &std_table_css);
 	report.end_div();
+	delete [] summary;
+	delete [] summary_data;
 }
 
 
src/report/report.cpp +2 -1
index d55531e..981e984 100644
@@ -115,7 +115,7 @@ static void system_info(void)
         init_title_attr(&title_attr);
 
 	/* Set array of data in row Major order */
-	string system_data[sys_table.rows * sys_table.cols];
+	string *system_data = new string[sys_table.rows * sys_table.cols];
 	system_data[0]=__("PowerTOP Version");
 	system_data[1]=POWERTOP_VERSION;
 
@@ -159,6 +159,7 @@ static void system_info(void)
 	report.end_div();
 	report.end_header();
 	report.add_navigation();
+	delete [] system_data;
 }
 
 void init_report_output(char *filename_str, int iterations)
src/tuning/tuning.cpp +6 -4
index 6367a20..85b80ac 100644
@@ -230,7 +230,7 @@ void report_show_tunables(void)
 		init_tune_table_attr(&tune_table_css, rows, cols);
 
 		/* Set array of data in row Major order */
-		string tunable_data[cols * rows];
+		string *tunable_data = new string[cols * rows];
 
 		tunable_data[0]=__("Description");
 		tunable_data[1]=__("Script");
@@ -249,6 +249,7 @@ void report_show_tunables(void)
 		/* Report Output */
 		report.add_title(&title_attr,__("Software Settings in Need of Tuning"));
 		report.add_table(tunable_data, &tune_table_css);
+		delete [] tunable_data;
 	}
 
 	/* Second Table */
@@ -258,7 +259,7 @@ void report_show_tunables(void)
 	init_tune_table_attr(&tune_table_css, rows, cols);
 
 	/* Set array of data in row Major order */
-	string untunable_data[rows];
+	string *untunable_data = new string[rows];
 	untunable_data[0]=__("Description");
 
 	for (i = 0; i < all_untunables.size(); i++)
@@ -267,6 +268,7 @@ void report_show_tunables(void)
 	/* Report Output */
 	report.add_title(&title_attr,__("Untunable Software Issues"));
 	report.add_table(untunable_data, &tune_table_css);
+	delete [] untunable_data;
 
 	/* Third Table */
 	/* Set Table attributes, rows, and cols */
@@ -275,7 +277,7 @@ void report_show_tunables(void)
 	init_std_table_attr(&tune_table_css, rows, cols);
 
 	/* Set array of data in row Major order */
-	string tuned_data[rows];
+	string *tuned_data = new string[rows];
 	tuned_data[0]=__("Description");
 	idx=cols;
 	for (i = 0; i < all_tunables.size(); i++) {
@@ -291,7 +293,7 @@ void report_show_tunables(void)
 	report.add_title(&title_attr,__("Optimal Tuned Software Settings"));
         report.add_table(tuned_data, &tune_table_css);
         report.end_div();
-
+	delete [] tuned_data;
 }
 
 void clear_tuning()
Signature · 1 line
2.0.4
author
#5 lore raw

PATCH 6/14 remove unnecessary assignments

In reply to Sami Kerola

Found using scan-build, Clang static analyzer.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/lib.cpp                | 8 ++++----
 src/main.cpp               | 6 ++++--
 src/process/do_process.cpp | 2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)
src/lib.cpp +4 -4
index a8f3746..b482296 100644
@@ -472,10 +472,10 @@ int read_msr(int cpu, uint64_t offset, uint64_t *value)
 	int fd;
 	char msr_path[256];
 
-	fd = sprintf(msr_path, "/dev/cpu/%d/msr", cpu);
+	sprintf(msr_path, "/dev/cpu/%d/msr", cpu);
 
 	if (access(msr_path, R_OK) != 0){
-		fd = sprintf(msr_path, "/dev/msr%d", cpu);
+		sprintf(msr_path, "/dev/msr%d", cpu);
 
 		if (access(msr_path, R_OK) != 0){
 			fprintf(stderr,
@@ -504,10 +504,10 @@ int write_msr(int cpu, uint64_t offset, uint64_t value)
 	int fd;
 	char msr_path[256];
 
-	fd = sprintf(msr_path, "/dev/cpu/%d/msr", cpu);
+	sprintf(msr_path, "/dev/cpu/%d/msr", cpu);
 
 	if (access(msr_path, R_OK) != 0){
-		fd = sprintf(msr_path, "/dev/msr%d", cpu);
+		sprintf(msr_path, "/dev/msr%d", cpu);
 
 		if (access(msr_path, R_OK) != 0){
 			fprintf(stderr,
src/main.cpp +4 -2
index cf4e547..99a985f 100644
@@ -315,8 +315,10 @@ static void powertop_init(void)
 	rlmt.rlim_cur = rlmt.rlim_max = get_nr_open();
 	setrlimit (RLIMIT_NOFILE, &rlmt);
 
-	ret = system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1");
-	ret = system("/sbin/modprobe msr > /dev/null 2>&1");
+	if (system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1"))
+		fprintf(stderr, _("modprobe cpufreq_stats failed"));
+	if (system("/sbin/modprobe msr > /dev/null 2>&1"))
+		fprintf(stderr, _("modprobe msr failed"));
 	statfs("/sys/kernel/debug", &st_fs);
 
 	if (st_fs.f_type != (long) DEBUGFS_MAGIC) {
src/process/do_process.cpp +1 -1
index 8d55507..dd7d982 100644
@@ -579,7 +579,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
 		consumer_child_time(cpu, t);
 	}
 	else if (strcmp(event->name, "cpu_idle") == 0) {
-		ret = pevent_get_field_val(NULL, event, "state", &rec, &val, 0);
+		pevent_get_field_val(NULL, event, "state", &rec, &val, 0);
 		if (val == (unsigned int)-1)
 			consume_blame(cpu);
 		else
Signature · 1 line
2.0.4
author
#6 lore raw

PATCH 7/14 remove unnecessary code reported by cppcheck

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/cpu/rapl/rapl_interface.cpp | 4 ++--
 src/devices/alsa.cpp            | 1 -
 src/display.cpp                 | 9 ++-------
 src/tuning/runtime.cpp          | 4 ----
 src/tuning/tuning.cpp           | 1 -
 5 files changed, 4 insertions(+), 15 deletions(-)
src/cpu/rapl/rapl_interface.cpp +2 -2
index a19e0a9..ab8e8ce 100644
@@ -647,9 +647,9 @@ void c_rapl_interface::rapl_measure_energy()
 	double pp0_joules = 0;
 	double pp1_joules = 0;
 
-	ret = get_pkg_power_info(&thermal_spec_power, &max_power, &min_power, &max_time_window);
+	get_pkg_power_info(&thermal_spec_power, &max_power, &min_power, &max_time_window);
 	RAPL_DBG_PRINT("Pkg Power Info: Thermal spec %f watts, max %f watts, min %f watts, max time window %f seconds\n", thermal_spec_power, max_power, min_power, max_time_window);
-	ret = get_dram_power_info(&thermal_spec_power, &max_power, &min_power, &max_time_window);
+	get_dram_power_info(&thermal_spec_power, &max_power, &min_power, &max_time_window);
 	RAPL_DBG_PRINT("DRAM Power Info: Thermal spec %f watts, max %f watts, min %f watts, max time window %f seconds\n", thermal_spec_power, max_power, min_power, max_time_window);
 
 	for (;;) {
src/devices/alsa.cpp +0 -1
index 5dee334..a1fca71 100644
@@ -154,7 +154,6 @@ static void create_all_alsa_callback(const char *d_name)
 {
 	char filename[4096];
 	class alsa *bl;
-	ofstream file;
 
 	if (strncmp(d_name, "hwC", 3) != 0)
 		return;
src/display.cpp +2 -7
index c76ba27..123620a 100644
@@ -267,13 +267,8 @@ void cursor_up(void)
 	if (w) {
 		w->cursor_up(); 
 		if(w->ypad_pos > 0) {
-			if (tab_names[current_tab] == "Tunables") {
-				prefresh(w->win, --w->ypad_pos, w->xpad_pos, 
-					1, 0, LINES - 3, COLS - 1);
-	                } else {
-				prefresh(w->win, --w->ypad_pos, w->xpad_pos, 
-					1, 0, LINES - 3, COLS - 1);
-			}
+			prefresh(w->win, --w->ypad_pos, w->xpad_pos,
+				 1, 0, LINES - 3, COLS - 1);
 		}
 	}
 	
src/tuning/runtime.cpp +0 -4
index b57d53e..3201fdd 100644
@@ -139,10 +139,6 @@ void add_runtime_tunables(const char *bus)
 		if (entry->d_name[0] == '.')
 			continue;
 
-		sprintf(filename, "/sys/bus/%s/devices/%s", bus, entry->d_name);
-
-
-
 		sprintf(filename, "/sys/bus/%s/devices/%s/power/control", bus, entry->d_name);
 
 		if (access(filename, R_OK) != 0)
src/tuning/tuning.cpp +0 -1
index 85b80ac..7d64cad 100644
@@ -198,7 +198,6 @@ void report_show_tunables(void)
 	unsigned int i;
 	/* three tables; bad, unfixable, good */
 	sort_tunables();
-	string srt_tmp;
 	int idx, rows = 0, cols;
 
 	/* First Table */
Signature · 1 line
2.0.4
author
#7 lore raw

PATCH 8/14 add short options to usage, and order the options data

In reply to Sami Kerola

Earlier user experience was pretty unintuitive. For example -h is often help, and it generated an error, but had nothing in usage to tell what the -h does.

The option data in struct option, print_usage(), getopt_long() optstring, and getopt_long switch() case, are made to be same order. All options are in long-option alphabetical order, with exception of --version and --help that are the last in the list.

Some options where meant to be used as long-only options. These are made unreachable by making the option character to be out side of range what user can type.

Finally when unknown option is exiting the return value is changed from zero to one to indicate a failure.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 154 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 78 insertions(+), 76 deletions(-)
src/main.cpp +78 -76
index 99a985f..3b67ef0 100644
@@ -69,21 +69,27 @@ int debug_learning = 0;
 unsigned time_out = 20;
 int leave_powertop = 0;
 
+enum {
+	OPT_AUTO_TUNE = CHAR_MAX + 1,
+	OPT_EXTECH,
+	OPT_DEBUG
+};
+
 static const struct option long_options[] =
 {
 	/* These options set a flag. */
-	{"debug", no_argument, &debug_learning, 'd'},
-	{"version", no_argument, NULL, 'V'},
-	{"help",no_argument, NULL, 'u'}, /* u for usage */
-	{"calibrate",no_argument, NULL, 'c'},
-	{"auto-tune",no_argument, NULL, 'a'},
-	{"html", optional_argument, NULL, 'h'},
+	{"auto-tune", no_argument, NULL, OPT_AUTO_TUNE},
+	{"calibrate", no_argument, NULL, 'c'},
 	{"csv", optional_argument, NULL, 'C'},
-	{"extech", optional_argument, NULL, 'e'},
-	{"time", optional_argument, NULL, 't'},
+	{"debug", no_argument, &debug_learning, OPT_DEBUG},
+	{"extech", optional_argument, NULL, OPT_EXTECH},
+	{"html", optional_argument, NULL, 'h'},
 	{"iteration", optional_argument, NULL, 'i'},
-	{"workload", optional_argument, NULL, 'w'},
 	{"quiet", no_argument, NULL, 'q'},
+	{"time", optional_argument, NULL, 't'},
+	{"workload", optional_argument, NULL, 'w'},
+	{"version", no_argument, NULL, 'V'},
+	{"help", no_argument, NULL, 'u'},	/* u for usage */
 	{NULL, 0, NULL, 0}
 };
 
@@ -108,21 +114,21 @@ static bool set_refresh_timeout()
 
 static void print_usage()
 {
-	printf("%s\n\n",_("Usage: powertop [OPTIONS]"));
-	printf("--debug \t\t %s\n",_("run in \"debug\" mode"));
-	printf("--version \t\t %s\n",_("print version information"));
-	printf("--calibrate \t\t %s\n",_("runs powertop in calibration mode"));
-	printf("--auto-tune \t\t %s\n",_("Sets all tunable options to their GOOD setting"));
-	printf("--extech%s \t %s\n",_("[=devnode]"),_("uses an Extech Power Analyzer for measurements"));
-	printf("--html%s \t %s\n",_("[=FILENAME]"),_("generate a html report"));
-	printf("--csv%s \t %s\n",_("[=FILENAME]"),_("generate a csv report"));
-	printf("--time%s \t %s\n",_("[=seconds]"), _("generate a report for 'x' seconds"));
-	printf("--iteration%s\n", _("[=iterations] number of times to run each test"));
-	printf("--workload%s \t %s\n", _("[=workload]"), _("file to execute for workload"));
-	printf("--quiet \t\t %s\n", _("suppress stderr output"));
-	printf("--help \t\t\t %s\n",_("print this help menu"));
+	printf("%s\n\n", _("Usage: powertop [OPTIONS]"));
+	printf("     --auto-tune\t %s\n", _("sets all tunable options to their GOOD setting"));
+	printf(" -c, --calibrate\t %s\n", _("runs powertop in calibration mode"));
+	printf(" -C, --csv%s\t %s\n", _("[=filename]"), _("generate a csv report"));
+	printf("     --debug\t\t %s\n", _("run in \"debug\" mode"));
+	printf("     --extech%s\t %s\n", _("[=devnode]"), _("uses an Extech Power Analyzer for measurements"));
+	printf(" -h, --html%s\t %s\n", _("[=filename]"), _("generate a html report"));
+	printf(" -i, --iteration%s\n", _("[=iterations] number of times to run each test"));
+	printf(" -q, --quiet\t\t %s\n", _("suppress stderr output"));
+	printf(" -t, --time%s\t %s\n", _("[=seconds]"), _("generate a report for 'x' seconds"));
+	printf(" -w, --workload%s %s\n", _("[=workload]"), _("file to execute for workload"));
+	printf(" -V, --version\t\t %s\n", _("print version information"));
+	printf(" -u, --help\t\t %s\n", _("print this help menu"));
 	printf("\n");
-	printf("%s\n\n",_("For more help please refer to the README"));
+	printf("%s\n\n", _("For more help please refer to the 'man 8 powertop'"));
 }
 
 static void do_sleep(int seconds)
@@ -380,63 +386,59 @@ int main(int argc, char **argv)
 #endif
 
 	while (1) { /* parse commandline options */
-		c = getopt_long (argc, argv, "ch:C:i:t:uVw:q", long_options, &option_index);
+		c = getopt_long(argc, argv, "cC:h:i:qt:w:Vu", long_options, &option_index);
 		/* Detect the end of the options. */
 		if (c == -1)
 			break;
-
 		switch (c) {
-			case 'V':
-				print_version();
-				exit(0);
-				break;
-
-			case 'e': /* Extech power analyzer support */
-				checkroot();
-				extech_power_meter(optarg ? optarg : "/dev/ttyUSB0");
-				break;
-			case 'u':
-				print_usage();
-				exit(0);
-				break;
-			case 'a':
-				auto_tune = 1;
-				leave_powertop = 1;
-				break;
-			case 'c':
-				powertop_init();
-				calibrate();
-				break;
-
-			case 'h': /* html report */
-				reporttype = REPORT_HTML;
-				sprintf(filename, "%s", optarg ? optarg : "powertop.html" );
-				break;
-
-			case 't':
-				time_out = (optarg ? atoi(optarg) : 20);
-				break;
-
-			case 'i':
-				iterations = (optarg ? atoi(optarg) : 1);
-				break;
-
-			case 'w': /* measure workload */
-				sprintf(workload, "%s", optarg ? optarg :'\0' );
-				break;
-			case 'q':
-				if(freopen("/dev/null", "a", stderr))
-					fprintf(stderr, _("Quite mode failed!\n"));
-				break;
-
-			case 'C': /* csv report*/
-				reporttype = REPORT_CSV;
-				sprintf(filename, "%s", optarg ? optarg : "powertop.csv");
-				break;
-			case '?': /* Unknown option */
-				/* getopt_long already printed an error message. */
-				exit(0);
-				break;
+		case OPT_AUTO_TUNE:
+			auto_tune = 1;
+			leave_powertop = 1;
+			break;
+		case 'c':
+			powertop_init();
+			calibrate();
+			break;
+		case 'C':		/* csv report */
+			reporttype = REPORT_CSV;
+			sprintf(filename, "%s", optarg ? optarg : "powertop.csv");
+			break;
+		case OPT_DEBUG:
+			/* implemented using getopt_long(3) flag */
+			break;
+		case OPT_EXTECH:	/* Extech power analyzer support */
+			checkroot();
+			extech_power_meter(optarg ? optarg : "/dev/ttyUSB0");
+			break;
+		case 'h':		/* html report */
+			reporttype = REPORT_HTML;
+			sprintf(filename, "%s", optarg ? optarg : "powertop.html");
+			break;
+		case 'i':
+			iterations = (optarg ? atoi(optarg) : 1);
+			break;
+		case 'q':
+			if (freopen("/dev/null", "a", stderr))
+				fprintf(stderr, _("Quite mode failed!\n"));
+			break;
+		case 't':
+			time_out = (optarg ? atoi(optarg) : 20);
+			break;
+		case 'w':		/* measure workload */
+			sprintf(workload, "%s", optarg ? optarg : '\0');
+			break;
+		case 'V':
+			print_version();
+			exit(0);
+			break;
+		case 'u':
+			print_usage();
+			exit(0);
+			break;
+		case '?':		/* Unknown option */
+			/* getopt_long already printed an error message. */
+			exit(1);
+			break;
 		}
 	}
 
Signature · 1 line
2.0.4
author
#8 lore raw

PATCH 9/14 do not use ncurses when --auto-tune is specified

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
src/main.cpp +6 -3
index 3b67ef0..4bfd038 100644
@@ -460,7 +460,8 @@ int main(int argc, char **argv)
 		end_pci_access();
 		exit(0);
 	}
-	init_display();
+	if (!auto_tune)
+		init_display();
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -473,11 +474,13 @@ int main(int argc, char **argv)
 	}
 
 	while (!leave_powertop) {
-		show_cur_tab();
+		if (!auto_tune)
+			show_cur_tab();
 		one_measurement(time_out, NULL);
 		learn_parameters(15, 0);
 	}
-	endwin();
+	if (!auto_tune)
+		endwin();
 	printf("%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
Signature · 1 line
2.0.4
#9 lore raw

Re: [Powertop] [PATCH 09/14] do not use ncurses when --auto-tune is specified

Quoted 10 lines · Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
src/main.cpp +0 -0
index 3b67ef0..4bfd038 100644

src/main.cpp int main(int argc, char **argv) · line 464

Quoted 6 lines
src/main.cpp +2 -1
@@ -460,7 +460,8 @@ int main(int argc, char **argv)
 		end_pci_access();
 		exit(0);
 	}
-	init_display();
+	if (!auto_tune)
+		init_display();

tuning use ui_notify_user(), which requires ncurses. yes, there is only one place where we notify user via ui_notify_user(), but, in general, we can (and should) use this function for error reporting back to user as well, since fprintf to stderr is less correct/nice way to yell about something important/critical.

	-ss
Quoted 27 lines
src/main.cpp +4 -2
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -473,11 +474,13 @@ int main(int argc, char **argv)
 	}
 
 	while (!leave_powertop) {
-		show_cur_tab();
+		if (!auto_tune)
+			show_cur_tab();
 		one_measurement(time_out, NULL);
 		learn_parameters(15, 0);
 	}
-	endwin();
+	if (!auto_tune)
+		endwin();
 	printf("%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
Signature · 6 lines
2.0.4

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

Re: [Powertop] [PATCH 09/14] do not use ncurses when --auto-tune is specified

In reply to Sami Kerola
Quoted 5 lines · Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

I think it makes sense to extend ui_notify_user() so it can cover both cases: initialised ncurses -- calling mvprintw(), and uninitialised ncurses -- printf (to stdout).

this will change a bit 'powertop --auto-tune' behaviour, since by default user will now see a 'list' of commands executed by powertop, but it's really easy to silent powertop via stdout redirection.

what do you think?

	-ss
Quoted 38 lines
src/main.cpp +6 -3
index 3b67ef0..4bfd038 100644
@@ -460,7 +460,8 @@ int main(int argc, char **argv)
 		end_pci_access();
 		exit(0);
 	}
-	init_display();
+	if (!auto_tune)
+		init_display();
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -473,11 +474,13 @@ int main(int argc, char **argv)
 	}
 
 	while (!leave_powertop) {
-		show_cur_tab();
+		if (!auto_tune)
+			show_cur_tab();
 		one_measurement(time_out, NULL);
 		learn_parameters(15, 0);
 	}
-	endwin();
+	if (!auto_tune)
+		endwin();
 	printf("%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
Signature · 6 lines
2.0.4

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
author
#11 lore raw

Re: [Powertop] [PATCH 09/14] do not use ncurses when --auto-tune is specified

Quoted 11 lines · Sergey Senozhatsky
Quoted 5 lines · Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

I think it makes sense to extend ui_notify_user() so it can cover both cases: initialised ncurses -- calling mvprintw(), and uninitialised ncurses -- printf (to stdout).

Quoted 6 lines

this will change a bit 'powertop --auto-tune' behaviour, since by default user will now see a 'list' of commands executed by powertop, but it's really easy to silent powertop via stdout redirection.

what do you think?

Hi Sergey,

I think this patch set will need to get ready eventually. Would it be possible that the upstream maintainer will drop the patch 0007 aka 'do not use ncurses' and merge the rest (assuming they are not unmentioned way borken).

Since my primary goal when I started to do anything with powertop was to get rid of --auto-tune blinking I will craft another change that will do exactly that. But as mentioned, there is error reporting that must not break as side effect. Because a signal to do printing different way is command line option driven it is probably best to add a control structure that will allow to do that, and allow easy extensions in future when similar needs appear.

What comes to stdout redirection, you are likely right. Making ncurses not to blink screen may require poking code a little bit here and there. To me that is a another good reason to separate the change set.

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
author Reviewed-by Sergey Senozhatsky
#12 lore raw

Re: [Powertop] [PATCH 09/14] do not use ncurses when --auto-tune is specified

Quoted 17 lines · Sami Kerola
Quoted 16 lines · Sergey Senozhatsky
Quoted 5 lines · Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

I think it makes sense to extend ui_notify_user() so it can cover both cases: initialised ncurses -- calling mvprintw(), and uninitialised ncurses -- printf (to stdout).

this will change a bit 'powertop --auto-tune' behaviour, since by default user will now see a 'list' of commands executed by powertop, but it's really easy to silent powertop via stdout redirection.

Quoted 6 lines
Quoted 1 line

what do you think?

I think this patch set will need to get ready eventually. Would it be possible that the upstream maintainer will drop the patch 0007 aka 'do not use ncurses' and merge the rest (assuming they are not unmentioned way borken).

Hello Sergey and others,

I had a bit of spare time so I started to look what exactly is calling mvprintw() via ui_notify_user(). My initial reaction was that I must have made some error in search, because I could not find such call. So I added abort() to the code...

index b482296..55c9603 100644

src/lib.cpp +1 -0
@@ -546,5 +546,6 @@ void ui_notify_user(const char *frmt, ...)
        vsnprintf(notify, UI_NOTIFY_BUFF_SZ - 1, frmt, list);
        va_end(list);
        mvprintw(1, 0, notify);
+       abort();
        attroff(COLOR_PAIR(1));
 }

...and found the --auto-tune does not entering to that function. When running in normal mode the call path is from main() -> one_measurement() -> do_sleep() -> cursor_enter() -> tuning_window::cursor_enter -> ui_notify_user() -> mvprintw().

I also realized the --auto-tune is setting leave_powertop = 1, which means the patch 0009 can be simplified. Here is better version of the change that avoids running unnecessary if().

--->8----
From: Sami Kerola <kerolasa(a)iki.fi>
Date: Wed, 20 Aug 2014 23:31:52 +0300
Subject: [PATCH 09/14] do not use ncurses when --auto-tune is specified

Reviewed-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/main.cpp +4 -2
index 3b67ef0..bd0fc88 100644
@@ -460,7 +460,8 @@ int main(int argc, char **argv)
 		end_pci_access();
 		exit(0);
 	}
-	init_display();
+	if (!auto_tune)
+		init_display();
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -477,7 +478,8 @@ int main(int argc, char **argv)
 		one_measurement(time_out, NULL);
 		learn_parameters(15, 0);
 	}
-	endwin();
+	if (!auto_tune)
+		endwin();
 	printf("%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
Signature · 1 line
2.1.0
#13 lore raw

Re: [Powertop] [PATCH 09/14] do not use ncurses when --auto-tune is specified

Quoted 18 lines · Sami Kerola

Hello Sergey and others,

I had a bit of spare time so I started to look what exactly is calling mvprintw() via ui_notify_user(). My initial reaction was that I must have made some error in search, because I could not find such call. So I added abort() to the code...

index b482296..55c9603 100644

src/lib.cpp +1 -0
@@ -546,5 +546,6 @@ void ui_notify_user(const char *frmt, ...)
        vsnprintf(notify, UI_NOTIFY_BUFF_SZ - 1, frmt, list);
        va_end(list);
        mvprintw(1, 0, notify);
+       abort();
        attroff(COLOR_PAIR(1));
 }
Quoted 5 lines

...and found the --auto-tune does not entering to that function. When running in normal mode the call path is from main() -> one_measurement() -> do_sleep() -> cursor_enter() -> tuning_window::cursor_enter -> ui_notify_user() -> mvprintw().

oh, yes. my bad, I didn't double check. auto-tune calls all_tunables[i]->toggle() directly.

ok. then everything should be fine.

	-ss
Quoted 42 lines

I also realized the --auto-tune is setting leave_powertop = 1, which means the patch 0009 can be simplified. Here is better version of the change that avoids running unnecessary if().

--->8----
From: Sami Kerola <kerolasa(a)iki.fi>
Date: Wed, 20 Aug 2014 23:31:52 +0300
Subject: [PATCH 09/14] do not use ncurses when --auto-tune is specified

Reviewed-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/main.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/main.cpp +4 -2
index 3b67ef0..bd0fc88 100644
@@ -460,7 +460,8 @@ int main(int argc, char **argv)
 		end_pci_access();
 		exit(0);
 	}
-	init_display();
+	if (!auto_tune)
+		init_display();
 	initialize_tuning();
 	/* first one is short to not let the user wait too long */
 	one_measurement(1, NULL);
@@ -477,7 +478,8 @@ int main(int argc, char **argv)
 		one_measurement(time_out, NULL);
 		learn_parameters(15, 0);
 	}
-	endwin();
+	if (!auto_tune)
+		endwin();
 	printf("%s\n", _("Leaving PowerTOP"));
 
 	end_process_data();
Signature · 1 line
2.1.0
author
#14 lore raw

PATCH 10/14 improve manual groff syntax

In reply to Sami Kerola

Use header macro .TH expected way. Use English spacing, that means two spaces after a dot. Use simple font macros, such as .B or .BR, where possible rather than \fB inline selectors. Highlight option arguments consistently, also in description segments. Convert interactive commands to a table. Use mail and web address macros when appropriate.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 doc/powertop.8 | 141 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 71 insertions(+), 70 deletions(-)
doc/powertop.8 +71 -70
index 3535a21..31e7e6d 100644
@@ -1,94 +1,95 @@
-.TH POWERTOP 8 "June 1, 2012" "Linux" "powertop manual"
+.TH POWERTOP "8" "2014-08-02" "powertop manual" "System Administration"
 .SH NAME
 powertop \- a power consumption and power management diagnosis tool.
 .SH SYNOPSIS
 .B powertop
-.RB [
-.IR options
-.RB ]
+.RI [ options ]
 .SH DESCRIPTION
-.P
-\fBpowertop\fP is a program that helps to diagnose various issues with power consumption
-and power management. It also has an interactive mode allowing one to
-experiment with various power management settings. When invoking powertop
-without arguments powertop starts in interactive mode.
+.B powertop
+is a program that helps to diagnose various issues with power consumption
+and power management.  It also has an interactive mode allowing one to
+experiment with various power management settings.  When invoking
+powertop without arguments powertop starts in interactive mode.
 .SH OPTIONS
 .TP
-\fB\-\-calibrate
-runs powertop in calibration mode. When running on battery, powertop
-can track power consumption as well as system activity. When there
-are enough measurements, powertop can start to report power estimates. One
+.B \-\-calibrate
+Runs powertop in calibration mode.  When running on battery, powertop can
+track power consumption as well as system activity.  When there are
+enough measurements, powertop can start to report power estimates.  One
 can get more accurate estimates by using this option to enable a
-calibration cycle. This will cycle through various display levels and USB
-device activities and workloads.
+calibration cycle.  This will cycle through various display levels and
+USB device activities and workloads.
 .TP
-\fB\-\-csv[\fR=\fIFILENAME\fR]
-generate a CSV report. If a filename is not specified then the
-default name "powertop.csv" is used. The CSV report can be
-used for reporting and data analysis.
+\fB\-\-csv\fR[=\fIfilename\fR]
+Generate a CSV report.  If a
+.I filename
+is not specified then the default name
+.B powertop.csv
+is used.  The CSV report can be used for reporting and data analysis.
 .TP
-\fB\-\-debug
- run in "debug" mode.
+.B \-\-debug
+Run in "debug" mode.
 .TP
 \fB\-\-extech\fR=\fIdevnode\fR
-use the Extech Power Analyzer for measurements. This allows one to
+Use the Extech Power Analyzer for measurements.  This allows one to
 specify the serial device node of the serial to USB adaptor connecting to
-the Extech Power Analyzer, for example /dev/ttyUSB0.
+the Extech Power Analyzer, for example
+.IR /dev/ttyUSB0 .
 .TP
-\fB\-\-help
- show the help message.
+.B \-\-help
+Show the help message.
 .TP
-\fB\-\-html[\fR=\fIFILENAME\fR]
-generate an HTML report. If a filename is not specified then the
-default name "powertop.html" is used. The HTML report can be
-sent to others to help diagnose power issues.
+\fB\-\-html\fR[=\fIfilename\fR]
+Generate an HTML report.  If a
+.I filename
+is not specified then the default name
+.B powertop.html
+is used.  The HTML report can be sent to others to help diagnose power
+issues.
 .TP
-\fB\-\-iteration[\fR=\fIiterations\fR]
-number of times to run each test.
+\fB\-\-iteration\fR[=\fIiterations\fR]
+Number of times to run each test.
 .TP
-\fB\-\-quiet
- suppress stderr output.
+.B \-\-quiet
+Suppress stderr output.
 .TP
-\fB\-\-time[\fR=\fIseconds\fR]
-generate a report for a specified number of seconds.
+\fB\-\-time\fR[=\fIseconds\fR]
+Generate a report for a specified number of
+.IR seconds .
 .TP
-\fB\-\-version
-print version information and exit.
+.B \-\-version
+Print version information and exit.
 .SH COMMANDS
 In interactive mode, the following key bindings are available:
-.TP
-\fBTab
-Show next tab
-.TP
-\fBBackTab
-Show previous tab
-.TP
-\fBRight Arrow
-Scroll to the right
-.TP
-\fBLeft Arrow
-Scroll to the left
-.TP
-\fBUp Arrow, PageUp
-Scroll up or select previous item
-.TP
-\fBDown Arrow, PageDown
-Scroll down or select next item
-.TP
-\fBSpace, Return
-Activate current item
-.TP
-\fBs
-Set refresh timeout
-.TP
-\fBr
-Refresh window
-.TP
-\fBq, Ctrl-C, Escape
-Exit powertop
+.IP
+.TS
+tab(@);
+l l.
+\fBTab\fR(a)Show next tab
+\fBBackTab\fR(a)Show previous tab
+\fBRight Arrow\fR(a)Scroll to the right
+\fBLeft Arrow\fR(a)Scroll to the left
+\fBUp Arrow\fR, \fBPageUp\fR(a)Scroll up or select previous item
+\fBDown Arrow\fR, \fBPageDown\fR(a)Scroll down or select next item
+\fBSpace\fR, \fBReturn\fR(a)Activate current item
+\fBs\fR(a)Set refresh timeout
+\fBr\fR(a)Refresh window
+\fBq\fR, \fBCtrl-C\fR, \fBEscape\fR(a)Exit powertop
+.TE
 .SH BUGS
-Send bug reports to <powertop(a)lists.01.org>
+Send bug reports to
+.MT powertop(a)lists.01.org
+.ME
 .SH SEE ALSO
-The program is more fully described at https://01.org/powertop
+The program is more fully described at
+.UR https://01.org/powertop
+.UE
 .SH AUTHOR
-powertop was written by Arjan van de Ven <arjan(a)linux.intel.com>, and is currently maintained by Chris E Ferron <chris.e.ferron(a)linux.intel.com>.
+powertop was written by
+.MT arjan@\:linux.\:intel.\:com
+Arjan van de Ven
+.ME ,
+and is currently maintained by
+.MT chris.\:e.\:ferron@\:linux.\:intel.\:com
+Chris E Ferron
+.ME .
Signature · 1 line
2.0.4
author
#15 lore raw

PATCH 11/14 fix couple typos

In reply to Sami Kerola

Found with misspell-check.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 src/tuning/nl80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/tuning/nl80211.h +2 -2
index e4a8839..83b0514 100644
@@ -828,7 +828,7 @@ enum nl80211_commands {
  *	bit. Depending on which antennas are selected in the bitmap, 802.11n
  *	drivers can derive which chainmasks to use (if all antennas belonging to
  *	a particular chain are disabled this chain should be disabled) and if
- *	a chain has diversity antennas wether diversity should be used or not.
+ *	a chain has diversity antennas whether diversity should be used or not.
  *	HT capabilities (STBC, TX Beamforming, Antenna selection) can be
  *	derived from the available chains after applying the antenna mask.
  *	Non-802.11n drivers can derive wether to use diversity or not.
@@ -855,7 +855,7 @@ enum nl80211_commands {
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_attrs {
-/* don't change the order or add anything inbetween, this is ABI! */
+/* don't change the order or add anything between, this is ABI! */
 	NL80211_ATTR_UNSPEC,
 
 	NL80211_ATTR_WIPHY,
Signature · 1 line
2.0.4
author
#16 lore raw

PATCH 12/14 wrap lines in README.traceevent

In reply to Sami Kerola
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 README.traceevent | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
README.traceevent +13 -8
index 38563ab..0747766 100644
@@ -1,15 +1,20 @@
 traceevent: 
 
-The traceevent library being built in PowerTOP is really a effort by Steven Rostedt. 
-The long term intent is for Steven to push the trace event library to distributions, and consume it externally. Right now the PowerTOP project is keeping in sync with his code posted in the Linux kernel git under tools/lib/traceevent. 
-We will not take patches into the traceevent code directly, rather we will be re-basing 
-against that code base. 
+The traceevent library being built in PowerTOP is really a effort by
+Steven Rostedt.  The long term intent is for Steven to push the trace
+event library to distributions, and consume it externally.  Right now the
+PowerTOP project is keeping in sync with his code posted in the Linux
+kernel git under tools/lib/traceevent.  We will not take patches into the
+traceevent code directly, rather we will be re-basing against that code
+base.
 
 If you find a bug in the trace event code, you should to one of two things. 
 
-1. Send a patch to the PowerTOP mailing list, which will get forwared to Steven if appropriate. 
-2. Send a patch to the PowerTOP mailing list, cc <Steven Rostedt> rostedt(a)goodmis.org
+1. Send a patch to the PowerTOP mailing list, which will get forwared to
+   Steven if appropriate.
 
+2. Send a patch to the PowerTOP mailing list, and
+   CC: Steven Rostedt <rostedt(a)goodmis.org>
 
-Please do use the PowerTOP mailing list to discuss topics about traceevent as its used with PowerTOP.
-
+Please do use the PowerTOP mailing list to discuss topics about
+traceevent as its used with PowerTOP.
Signature · 1 line
2.0.4
author
#17 lore raw

PATCH 13/14 clean up .gitignore file

In reply to Sami Kerola

Keep the regular expressions, directories, and individual files separate understandable way.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 .gitignore | 111 +++++++++++++++++++++++++++----------------------------------
 1 file changed, 49 insertions(+), 62 deletions(-)
.gitignore +49 -62
index d00973f..b9188a1 100644
@@ -1,66 +1,53 @@
-*~
-*.o
+# regular expressions
 *.a
-*.html
 *.csv
-*.powertop
-ChangeLog
-Makefile.in
-aclocal.m4
-config.guess
-config.h.in
-config.rpath
-config.sub
-configure
-depcomp
-install-sh
-ltmain.sh
-missing
-stamp-h1
-Makefile
-config.h
-config.log
-config.status
-libtool
-pevent/.deps/
-pevent/Makefile
-pevent/Makefile.in
-po/Makefile
-po/Makevars.template
-po/POTFILES
-po/Rules-quot
-po/boldquot.sed
-po/en(a)boldquot.header
-po/en(a)quot.header
-po/insert-header.sin
-po/quot.sed
-po/remove-potcdate.sin
-po/*.gmo
-po/stamp-po
-src/powertop
-src/css.h
-src/Makefile.in
-src/.deps/
-src/Makefile
-src/calibrate/.deps/
-src/cpu/.deps/
-src/cpu/rapl/.deps
-src/devices/.deps/
-src/measurement/.deps/
-src/parameters/.deps/
-src/perf/.deps/
-src/process/.deps/
-src/tuning/.deps/
-src/report/.deps/
-m4
 *.dirstamp
-*.lo
+*.html
 *.la
-autom4te.cache
-remove-potcdate.sed
-compile
-stamp-po
-ABOUT-NLS
-ar-lib
-traceevent/.deps/
-traceevents/.libs/
+*.lo
+*.o
+*.powertop
+*~
+.deps
+/po/*.gmo
+Makefile
+Makefile.in
+
+# directories
+/m4/
+
+# individual files
+/ABOUT-NLS
+/ChangeLog
+/aclocal.m4
+/ar-lib
+/autom4te.cache
+/compile
+/config.guess
+/config.h
+/config.h.in
+/config.log
+/config.rpath
+/config.status
+/config.sub
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/missing
+/po/Makevars.template
+/po/POTFILES
+/po/Rules-quot
+/po/boldquot.sed
+/po/en(a)boldquot.header
+/po/en(a)quot.header
+/po/insert-header.sin
+/po/quot.sed
+/po/remove-potcdate.sin
+/po/stamp-po
+/remove-potcdate.sed
+/src/css.h
+/src/powertop
+/stamp-h1
+/stamp-po
Signature · 1 line
2.0.4
author
#18 lore raw

PATCH 14/14 add --auto-tune and --workload to manual page

In reply to Sami Kerola

Options in manual page are now in same order as in usage output, and they include short options when aplicable.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 doc/powertop.8 | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
doc/powertop.8 +19 -11
index 31e7e6d..8f93c43 100644
@@ -12,7 +12,10 @@ experiment with various power management settings.  When invoking
 powertop without arguments powertop starts in interactive mode.
 .SH OPTIONS
 .TP
-.B \-\-calibrate
+.B \-\-auto\-tune
+Set all tunable options to their good setting without interaction.
+.TP
+.BR \-c ", " \-\-calibrate
 Runs powertop in calibration mode.  When running on battery, powertop can
 track power consumption as well as system activity.  When there are
 enough measurements, powertop can start to report power estimates.  One
@@ -20,7 +23,7 @@ can get more accurate estimates by using this option to enable a
 calibration cycle.  This will cycle through various display levels and
 USB device activities and workloads.
 .TP
-\fB\-\-csv\fR[=\fIfilename\fR]
+\fB\-C\fR, \fB\-\-csv\fR[=\fIfilename\fR]
 Generate a CSV report.  If a
 .I filename
 is not specified then the default name
@@ -28,7 +31,7 @@ is not specified then the default name
 is used.  The CSV report can be used for reporting and data analysis.
 .TP
 .B \-\-debug
-Run in "debug" mode.
+Run in debug mode.
 .TP
 \fB\-\-extech\fR=\fIdevnode\fR
 Use the Extech Power Analyzer for measurements.  This allows one to
@@ -36,10 +39,7 @@ specify the serial device node of the serial to USB adaptor connecting to
 the Extech Power Analyzer, for example
 .IR /dev/ttyUSB0 .
 .TP
-.B \-\-help
-Show the help message.
-.TP
-\fB\-\-html\fR[=\fIfilename\fR]
+\fB\-h\fR, \fB\-\-html\fR[=\fIfilename\fR]
 Generate an HTML report.  If a
 .I filename
 is not specified then the default name
@@ -47,18 +47,26 @@ is not specified then the default name
 is used.  The HTML report can be sent to others to help diagnose power
 issues.
 .TP
-\fB\-\-iteration\fR[=\fIiterations\fR]
+\fB\-i\fR, \fB\-\-iteration\fR[=\fIiterations\fR]
 Number of times to run each test.
 .TP
-.B \-\-quiet
+.BR \-q ", " \-\-quiet
 Suppress stderr output.
 .TP
-\fB\-\-time\fR[=\fIseconds\fR]
+\fB\-t\fR, \fB\-\-time\fR[=\fIseconds\fR]
 Generate a report for a specified number of
 .IR seconds .
 .TP
-.B \-\-version
+\fB\-w\fR, \fB\-\-workload\fR[=\fIworkload\fR]
+Execute
+.I workload
+file as a part of calibration before making a report.
+.TP
+.BR \-V ", " \-\-version
 Print version information and exit.
+.TP
+.BR \-u ", " \-\-help
+Show the help message and exit.
 .SH COMMANDS
 In interactive mode, the following key bindings are available:
 .IP
Signature · 1 line
2.0.4
#19 lore raw

Re: [Powertop] [PATCH 14/14] add --auto-tune and --workload to manual page

Hi Sami,

Quoted 91 lines

Options in manual page are now in same order as in usage output, and they include short options when aplicable.

Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 doc/powertop.8 | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
doc/powertop.8 +0 -0
index 31e7e6d..8f93c43 100644
@@ -12,7 +12,10 @@ experiment with various power management settings.

When invoking
powertop without arguments powertop starts in interactive mode. .SH OPTIONS
.TP
-.B \-\-calibrate
+.B \-\-auto\-tune

doc/powertop.8 +3 -0
+Set all tunable options to their good setting without interaction.
+.TP
+.BR \-c ", " \-\-calibrate
 Runs powertop in calibration mode.  When running on battery, powertop can
 track power consumption as well as system activity.  When there are
 enough measurements, powertop can start to report power estimates.  One
@@ -20,7 +23,7 @@ can get more accurate estimates by using this option to

enable a
calibration cycle. This will cycle through various display levels and USB device activities and workloads.
.TP
-\fB\-\-csv\fR[=\fIfilename\fR]
+\fB\-C\fR, \fB\-\-csv\fR[=\fIfilename\fR]
Generate a CSV report. If a
.I filename
is not specified then the default name

doc/powertop.8 +1 -1
@@ -28,7 +31,7 @@ is not specified then the default name
 is used.  The CSV report can be used for reporting and data analysis.
 .TP
 .B \-\-debug
-Run in "debug" mode.
+Run in debug mode.
 .TP
 \fB\-\-extech\fR=\fIdevnode\fR
 Use the Extech Power Analyzer for measurements.  This allows one to
@@ -36,10 +39,7 @@ specify the serial device node of the serial to USB

adaptor connecting to
the Extech Power Analyzer, for example
.IR /dev/ttyUSB0 .
.TP
-.B \-\-help

doc/powertop.8 +13 -8
-Show the help message.
-.TP
-\fB\-\-html\fR[=\fIfilename\fR]
+\fB\-h\fR, \fB\-\-html\fR[=\fIfilename\fR]
 Generate an HTML report.  If a
 .I filename
 is not specified then the default name
@@ -47,18 +47,26 @@ is not specified then the default name
 is used.  The HTML report can be sent to others to help diagnose power
 issues.
 .TP
-\fB\-\-iteration\fR[=\fIiterations\fR]
+\fB\-i\fR, \fB\-\-iteration\fR[=\fIiterations\fR]
 Number of times to run each test.
 .TP
-.B \-\-quiet
+.BR \-q ", " \-\-quiet
 Suppress stderr output.
 .TP
-\fB\-\-time\fR[=\fIseconds\fR]
+\fB\-t\fR, \fB\-\-time\fR[=\fIseconds\fR]
 Generate a report for a specified number of
 .IR seconds .
 .TP
-.B \-\-version
+\fB\-w\fR, \fB\-\-workload\fR[=\fIworkload\fR]
+Execute
+.I workload
+file as a part of calibration before making a report.
+.TP
+.BR \-V ", " \-\-version
 Print version information and exit.
+.TP
+.BR \-u ", " \-\-help
+Show the help message and exit.
 .SH COMMANDS
 In interactive mode, the following key bindings are available:
 .IP
--

2.0.4

Quoted 5 lines

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

Thank you for your contributions, they nicely clean up PowerTOP. I agree with you, I want to get you patches to our mainline tree as soon as possible.

For the next submission I need your help with:

0- When creating your patches modify the patch set subject using:
git format-patch --cover-letter --subject-prefix="PATCH Vx"... Where x
is the next version for your patches. For your next version use v3. This very useful for sorting purposes on my inbox.

1- Every time you make changes to your patches you would need to send the entire set of patches with an updated version. This link explains patch best practices that we follow on PowerTOP and across the Linux kernel community:
http://kernelnewbies.org/OPWfirstpatch#head-067c0e555973ae364180b2e3fbe90544e6aa378e

3- It is a good practice to add the names of the people who reviewed your patches, at the commit paragraph Reviewed_by:[the name of the person].

Here is my review to the 14 patches you sent on v2 of your code:

P1, P2, P4, P5, P6, P10, P11, P12, P13, and P14:
-Look good.

P3:
- Change the subject line to something more descriptive. Add a description of why are you making this change, and how it benefits PowerTOP. The subject lines and descriptions are very useful when bisecting the tree for debugging purposes.

P7:
- Please add a description to this patch. (Same reasoning as on P3)

P8:
- I have a problem naming -h --html and -u --help. Please change -h to --help, and use another letter for --html for instance: r as of report would be more fitting. New users will want to do powertop -h and see the help not the html report and get totally lost. It is just matter of reusing the already established usability metaphors.

P9:
- Please abbreviate the subject and add a description to this patch.
- To make this a feature-complete Sergey's feedback should be implemented:
"...to extend ui_notify_user() so it can cover both cases: initialised
ncurses -- calling mvprintw(), and uninitialised ncurses -- printf (to stdout). this will change a bit 'powertop --auto-tune' behaviour, since by default user will now see a 'list' of commands executed by powertop, but it's really easy to silent powertop via stdout redirection".

However, since this patch set is already long and this is the third spin on the list, I prefer you subtract P9 from this set of patches, make your work, and then send that as a separate set.

P9 is a very important patch because saves lots of run-time, hence power to the user.

Thank you,
Alexandra.

#20 lore raw

Re: [Powertop] [PATCH 14/14] add --auto-tune and --workload to manual page

Hello,

Quoted 42 lines · Alexandra Yates

Thank you for your contributions, they nicely clean up PowerTOP. I agree with you, I want to get you patches to our mainline tree as soon as possible.

For the next submission I need your help with:

0- When creating your patches modify the patch set subject using:

   git format-patch --cover-letter --subject-prefix="PATCH Vx"...  Where x

is the next version for your patches. For your next version use v3. This very useful for sorting purposes on my inbox.

1- Every time you make changes to your patches you would need to send the entire set of patches with an updated version. This link explains patch best practices that we follow on PowerTOP and across the Linux kernel community:
http://kernelnewbies.org/OPWfirstpatch#head-067c0e555973ae364180b2e3fbe90544e6aa378e

3- It is a good practice to add the names of the people who reviewed your patches, at the commit paragraph Reviewed_by:[the name of the person].

Here is my review to the 14 patches you sent on v2 of your code:

P1, P2, P4, P5, P6, P10, P11, P12, P13, and P14:
-Look good.

P3:
- Change the subject line to something more descriptive. Add a description of why are you making this change, and how it benefits PowerTOP. The subject lines and descriptions are very useful when bisecting the tree for debugging purposes.

P7:
- Please add a description to this patch. (Same reasoning as on P3)

P8:
- I have a problem naming -h --html and -u --help. Please change -h to --help, and use another letter for --html for instance: r as of report would be more fitting. New users will want to do powertop -h and see the help not the html report and get totally lost. It is just matter of reusing the already established usability metaphors.

Quoted 8 lines

P9:
- Please abbreviate the subject and add a description to this patch.
- To make this a feature-complete Sergey's feedback should be implemented:
"...to extend ui_notify_user() so it can cover both cases: initialised
ncurses -- calling mvprintw(), and uninitialised ncurses -- printf (to stdout). this will change a bit 'powertop --auto-tune' behaviour, since by default user will now see a 'list' of commands executed by powertop, but it's really easy to silent powertop via stdout redirection".

well, ui_notify_user() can wait. I didn't recall correctly and thought that ui_notify_user() is getting called from --auto-tune mode, which is not true. sorry for confusion.

we can have that unified ui_notify_user(), in general, and start using it for error/info reporting/notification, though. sometime in the future.

	-ss
Quoted 14 lines

However, since this patch set is already long and this is the third spin on the list, I prefer you subtract P9 from this set of patches, make your work, and then send that as a separate set.

P9 is a very important patch because saves lots of run-time, hence power to the user.

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

#21 lore raw
In reply to Sami Kerola
Quoted 9 lines · Sami Kerola

Horizontal lists has downside of being managed as a single entry in version control, which makes commits that add and remove items difficult to follow. With vertical lists each entry is managed separately, which is much nicer.

Additionally add project URL to autoconfig init, and pretty print macro expressions to have indentation, and bracing that follows more or less in K&R style.

hello,

at a glance, looks good.
though, I'm not really sure about "[PATCH 09/14] do not use ncurses when --auto-tune is specified".

thank you,

	-ss
Quoted 137 lines
Signed-off-by Sami Kerola <kerolasa(a)iki.fi>
---
 configure.ac | 82 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 67 insertions(+), 15 deletions(-)
configure.ac +67 -15
index 0b02ad2..b41cfb3 100644
@@ -2,15 +2,21 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.68])
-AC_INIT([powertop], [2.6.1], [powertop(a)lists.01.org])
-AM_INIT_AUTOMAKE([-Wall foreign ])
+AC_INIT([powertop], [2.6.1], [powertop(a)lists.01.org], [], [https://01.org/powertop])
+AM_INIT_AUTOMAKE([-Wall foreign])
 AC_LANG([C++])
-AC_CONFIG_FILES([Makefile src/Makefile traceevent/Makefile po/Makefile.in doc/Makefile])
+AC_CONFIG_FILES([
+	Makefile
+	src/Makefile
+	traceevent/Makefile
+	po/Makefile.in
+	doc/Makefile
+])
 AC_CONFIG_SRCDIR([src/main.cpp])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 GETTEXT_PACKAGE=powertop
-AC_SUBST(GETTEXT_PACKAGE)
+AC_SUBST([GETTEXT_PACKAGE])
 AM_SILENT_RULES([yes])
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.18])
@@ -26,7 +32,23 @@ AM_PROG_CC_C_O
 
 # Checks for libraries.
 # Checks for header files.
-AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h malloc.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/statfs.h sys/time.h termios.h unistd.h ncurses.h])
+AC_CHECK_HEADERS([ \
+	fcntl.h \
+	libintl.h \
+	limits.h \
+	locale.h \
+	malloc.h \
+	ncurses.h \
+	stdint.h \
+	stdlib.h \
+	string.h \
+	sys/ioctl.h \
+	sys/socket.h \
+	sys/statfs.h \
+	sys/time.h \
+	termios.h \
+	unistd.h \
+])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -44,20 +66,46 @@ AC_FUNC_MALLOC
 AC_FUNC_MMAP
 AC_FUNC_REALLOC
 AC_FUNC_STRTOD
-AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap pow realpath regcomp select setlocale socket sqrt strcasecmp strchr strdup strerror strncasecmp strstr strtoul strtoull])
+AC_CHECK_FUNCS([ \
+	fdatasync \
+	getpagesize \
+	gettimeofday \
+	memmove \
+	memset \
+	mkdir \
+	munmap \
+	pow \
+	realpath \
+	regcomp \
+	select \
+	setlocale \
+	socket \
+	sqrt \
+	strcasecmp \
+	strchr \
+	strdup \
+	strerror \
+	strncasecmp \
+	strstr \
+	strtoul \
+	strtoull \
+])
 
-PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"],
-	AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), []))
+PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"], [
+	AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], [
+		AC_MSG_ERROR([ncurses is required but was not found])
+	], [])
+])
 
 has_libpci=0
-PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
-	AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0] )])
+PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1], [
+	AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0])
+])
 
 
 has_libnl_ver=0
-# libnl-2 provides only libnl-2.0.pc file, so we check for separate libnl-genl-3.0.pc
-# pkg-config file just for libnl-3.0 case.
-#
+dnl libnl-2 provides only libnl-2.0.pc file, so we check for separate
+dnl libnl-genl-3.0.pc pkg-config file just for libnl-3.0 case.
 PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
 	PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
 		PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
@@ -78,7 +126,11 @@ if (test "$has_libpci" -eq 0); then
 	])
 fi
 
-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]), [])
+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])
+], [])
 
 AC_OUTPUT
Signature · 6 lines
2.0.4

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