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