Skip to contentSkip to conversation

main: Fix output when running workload

PATCH Applied Namhyung Kim 3 participants 3 messages Jan 14, 2013 – Jan 31, 2013

lore
Share & tools
lore

Namhyung Kim

author
#0 lore raw

PATCH 1/1 main: Fix output when running workload

Currently one_measurement() function prints following message after a successful run of the workload.

  $ sudo powertop --html --workload="sleep 1"
  Loaded 1 prior measurements
  Preparing to take measurements
  Measuring workload sleep 1.
  Unknown issue running workload!                         <-- here
  PowerTOP outputing using base filename powertop.html

It seems this was because it wrongly checks return value of system. The return value of the system() call is the status of wait() call so that it should be zero if things went well.

Signed-off-by Namhyung Kim <namhyung(a)gmail.com>
---
 src/main.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +1 -1
index b22d11d..0883424 100644
@@ -191,7 +191,7 @@ void one_measurement(int seconds, char *workload)
 	start_cpu_measurement();
 
 	if (workload && workload[0]) {
-		if (!system(workload))
+		if (system(workload))
 			fprintf(stderr, _("Unknown issue running workload!\n"));
 	} else {
 		do_sleep(seconds);
Signature · 1 line
1.7.9.2
#1 lore raw
Quoted 16 lines · Namhyung Kim

Date: Mon, 14 Jan 2013 23:49:32 +0900
From: Namhyung Kim <namhyung(a)gmail.com>
To: powertop(a)lists.01.org
Subject: [Powertop] [PATCH] main: Fix output when running workload
X-Mailer: git-send-email 1.7.9.2

Currently one_measurement() function prints following message after a successful run of the workload.

  $ sudo powertop --html --workload="sleep 1"
  Loaded 1 prior measurements
  Preparing to take measurements
  Measuring workload sleep 1.
  Unknown issue running workload!                         <-- here
  PowerTOP outputing using base filename powertop.html
Quoted 4 lines

It seems this was because it wrongly checks return value of system. The return value of the system() call is the status of wait() call so that it should be zero if things went well.

looks good to me, thanks.

Quoted 18 lines
Signed-off-by Namhyung Kim <namhyung(a)gmail.com>
---
 src/main.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +1 -1
index b22d11d..0883424 100644
@@ -191,7 +191,7 @@ void one_measurement(int seconds, char *workload)
 	start_cpu_measurement();
 
 	if (workload && workload[0]) {
-		if (!system(workload))
+		if (system(workload))
 			fprintf(stderr, _("Unknown issue running workload!\n"));
 	} else {
 		do_sleep(seconds);
Applied
#2 lore raw
In reply to Namhyung Kim
Quoted 24 lines · On Mon, 14 Jan 2013 23:49:32 +0900 Namhyung Kim <namhyung(a)gmail.com> wrote:

Currently one_measurement() function prints following message after a successful run of the workload.

  $ sudo powertop --html --workload="sleep 1"
  Loaded 1 prior measurements
  Preparing to take measurements
  Measuring workload sleep 1.
  Unknown issue running workload!                         <-- here
  PowerTOP outputing using base filename powertop.html

It seems this was because it wrongly checks return value of system. The return value of the system() call is the status of wait() call so that it should be zero if things went well.

Signed-off-by Namhyung Kim <namhyung(a)gmail.com>
---
 src/main.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.cpp +0 -0
index b22d11d..0883424 100644

src/main.cpp void one_measurement(int seconds, char *workload) · line 197

Quoted 8 lines
src/main.cpp +1 -1
@@ -191,7 +191,7 @@ void one_measurement(int seconds, char *workload)
 	start_cpu_measurement();
 
 	if (workload && workload[0]) {
-		if (!system(workload))
+		if (system(workload))
 			fprintf(stderr, _("Unknown issue running
 workload!\n")); } else {
 		do_sleep(seconds);

applied, thanks.

Kristen