powertop.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [Powertop] [PATCH POWERTOP] auto tune option to set everything to bad state
@ 2019-06-30  7:08 Arjan van de Ven
  0 siblings, 0 replies; 2+ messages in thread
From: Arjan van de Ven @ 2019-06-30  7:08 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On 6/29/2019 12:49 PM, Koosha Hosseiny wrote:
> Having the command `tuned-adm profile throughput-performance`, it's also nice to tell powertop to put everything in bad state.

so I'm not convinced on this. If all is bad you generally get lower throughput
(power is performance nowadays... the top performance range is in many systems clipped by TDP and if you waste 1 Watt on say a SATA link your CPU
may say lose 100Mhz or more of turbo mode performance)

but maybe I miss the objective you're trying to achieve?



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Powertop] [PATCH POWERTOP] auto tune option to set everything to bad state
@ 2019-06-29 19:49 Koosha Hosseiny
  0 siblings, 0 replies; 2+ messages in thread
From: Koosha Hosseiny @ 2019-06-29 19:49 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]

Having the command `tuned-adm profile throughput-performance`, it's also
nice to tell powertop to put everything in bad state.

Also available here: https://github.com/hkoosha/powertop

diff --git a/src/main.cpp b/src/main.cpp
index cbb7a4e..6c23f58 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -75,6 +75,7 @@ void (*ui_notify_user) (const char *frmt, ...);

 enum {
  OPT_AUTO_TUNE = CHAR_MAX + 1,
+ OPT_AUTO_UNTUNE,
  OPT_EXTECH,
  OPT_DEBUG
 };
@@ -83,6 +84,7 @@ static const struct option long_options[] =
 {
  /* These options set a flag. */
  {"auto-tune", no_argument, NULL, OPT_AUTO_TUNE},
+ {"auto-untune", no_argument, NULL, OPT_AUTO_UNTUNE},
  {"calibrate", no_argument, NULL, 'c'},
  {"csv", optional_argument, NULL, 'C'},
  {"debug", no_argument, &debug_learning, OPT_DEBUG},
@@ -454,6 +456,11 @@ int main(int argc, char **argv)
  leave_powertop = 1;
  ui_notify_user = ui_notify_user_console;
  break;
+ case OPT_AUTO_UNTUNE:
+ auto_tune = 2;
+ leave_powertop = 1;
+ ui_notify_user = ui_notify_user_console;
+ break;
  case 'c':
  powertop_init(0);
  calibrate();
@@ -545,7 +552,7 @@ int main(int argc, char **argv)
  tuning_update_display();
  show_tab(0);
  } else {
- auto_toggle_tuning();
+ auto_toggle_tuning(auto_tune);
  }

  while (!leave_powertop) {
diff --git a/src/tuning/tuning.cpp b/src/tuning/tuning.cpp
index a54a8ca..4d23ae3 100644
--- a/src/tuning/tuning.cpp
+++ b/src/tuning/tuning.cpp
@@ -316,10 +316,11 @@ void clear_tuning()
  all_untunables.clear();
 }

-void auto_toggle_tuning()
+void auto_toggle_tuning(int auto_tune)
 {
+  int flag = auto_tune == 1 ? TUNE_BAD : TUNE_GOOD;
  for (unsigned int i = 0; i < all_tunables.size(); i++) {
- if (all_tunables[i]->good_bad() == TUNE_BAD)
+ if (all_tunables[i]->good_bad() == flag)
  all_tunables[i]->toggle();
  }
 }
diff --git a/src/tuning/tuning.h b/src/tuning/tuning.h
index f70001b..fe3da76 100644
--- a/src/tuning/tuning.h
+++ b/src/tuning/tuning.h
@@ -29,5 +29,5 @@ extern void initialize_tuning(void);
 extern void tuning_update_display(void);
 extern void report_show_tunables(void);
 extern void clear_tuning(void);
-extern void auto_toggle_tuning(void);
+extern void auto_toggle_tuning(int);
 #endif

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 3014 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: powertop_auto_untune.diff --]
[-- Type: text/x-patch, Size: 2052 bytes --]

diff --git a/src/main.cpp b/src/main.cpp
index cbb7a4e..6c23f58 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -75,6 +75,7 @@ void (*ui_notify_user) (const char *frmt, ...);
 
 enum {
 	OPT_AUTO_TUNE = CHAR_MAX + 1,
+	OPT_AUTO_UNTUNE,
 	OPT_EXTECH,
 	OPT_DEBUG
 };
@@ -83,6 +84,7 @@ static const struct option long_options[] =
 {
 	/* These options set a flag. */
 	{"auto-tune",	no_argument,		NULL,		 OPT_AUTO_TUNE},
+	{"auto-untune",	no_argument,		NULL,		 OPT_AUTO_UNTUNE},
 	{"calibrate",	no_argument,		NULL,		 'c'},
 	{"csv",		optional_argument,	NULL,		 'C'},
 	{"debug",	no_argument,		&debug_learning, OPT_DEBUG},
@@ -454,6 +456,11 @@ int main(int argc, char **argv)
 			leave_powertop = 1;
 			ui_notify_user = ui_notify_user_console;
 			break;
+		case OPT_AUTO_UNTUNE:
+			auto_tune = 2;
+			leave_powertop = 1;
+			ui_notify_user = ui_notify_user_console;
+			break;
 		case 'c':
 			powertop_init(0);
 			calibrate();
@@ -545,7 +552,7 @@ int main(int argc, char **argv)
 		tuning_update_display();
 		show_tab(0);
 	} else {
-		auto_toggle_tuning();
+		auto_toggle_tuning(auto_tune);
 	}
 
 	while (!leave_powertop) {
diff --git a/src/tuning/tuning.cpp b/src/tuning/tuning.cpp
index a54a8ca..4d23ae3 100644
--- a/src/tuning/tuning.cpp
+++ b/src/tuning/tuning.cpp
@@ -316,10 +316,11 @@ void clear_tuning()
 	all_untunables.clear();
 }
 
-void auto_toggle_tuning()
+void auto_toggle_tuning(int auto_tune)
 {
+  int flag = auto_tune == 1 ? TUNE_BAD : TUNE_GOOD;
 	for (unsigned int i = 0; i < all_tunables.size(); i++) {
-		if (all_tunables[i]->good_bad() == TUNE_BAD)
+		if (all_tunables[i]->good_bad() == flag)
 			all_tunables[i]->toggle();
 	}
 }
diff --git a/src/tuning/tuning.h b/src/tuning/tuning.h
index f70001b..fe3da76 100644
--- a/src/tuning/tuning.h
+++ b/src/tuning/tuning.h
@@ -29,5 +29,5 @@ extern void initialize_tuning(void);
 extern void tuning_update_display(void);
 extern void report_show_tunables(void);
 extern void clear_tuning(void);
-extern void auto_toggle_tuning(void);
+extern void auto_toggle_tuning(int);
 #endif

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-30  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-30  7:08 [Powertop] [PATCH POWERTOP] auto tune option to set everything to bad state Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2019-06-29 19:49 Koosha Hosseiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).