tuning: print executed toggle script
Sergey Senozhatsky
PATCH 2/2 tuning: print executed toggle script
report executed toggle_script back to user via ui_notify_user().
Example:
Execute: echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
Execute: echo 'on' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
--- src/tuning/tuning.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
src/tuning/tuning.cpp +5 -1
@@ -141,11 +141,15 @@ void tuning_window::repaint(void) void tuning_window::cursor_enter(void) { class tunable *tun; - + const char *toggle_script; tun = all_tunables[cursor_pos]; if (!tun) return; + /** device will change its state so need to store toggle script before + * we toggle()*/ + toggle_script = tun->toggle_script(); tun->toggle(); + ui_notify_user("Execute: %s\n", toggle_script); } static bool tunables_sort(class tunable * i, class tunable * j)
Magnus Fromreide
Quoted 23 lines · Sergey Senozhatsky
report executed
toggle_scriptback to user viaui_notify_user().Example:
Execute: echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
Execute: echo 'on' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';Signed-off-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>--- src/tuning/tuning.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)src/tuning/tuning.cpp +1
-1@@ -141,11 +141,15 @@ void tuning_window::repaint(void) void tuning_window::cursor_enter(void) { class tunable *tun; - + const char *toggle_script; tun = all_tunables[cursor_pos];
src/tuning/tuning.cpp void tuning_window::repaint(void) · line 155
Quoted 10 lines
src/tuning/tuning.cpp +4
-0if (!tun) return; + /** device will change its state so need to store toggle script before + * we toggle()*/ + toggle_script = tun->toggle_script(); tun->toggle(); + ui_notify_user("Execute: %s\n", toggle_script); } static bool tunables_sort(class tunable * i, class tunable * j)
This only shows the toggle script when you run it, right?
What about the following:
src/tuning/tuning.cpp +5 -1
@@ -119,7 +119,11 @@ static void __tuning_update_display(int cursor_pos) wattrset(win, A_REVERSE); wprintw(win, ">> "); } - wprintw(win, "%s %s\n", _(res), _(desc)); + if (all_tunables[i]->good_bad() != TUNE_BAD) + wprintw(win, "%s %s\n", _(res), _(desc)); + else + wprintw(win, "%s %s %s\n", _(res), _(desc), + all_tunables[i]->toggle_script()); } }
which shows it in the list of bad tunables.
Maybe both are useful as my version have the disadvantage of not showing anything after the script is executed.
/MF
(attached a copy of the patch for easier applying)
src/tuning/tuning.cpp +5 -1
@@ -119,7 +119,11 @@ static void __tuning_update_display(int cursor_pos) wattrset(win, A_REVERSE); wprintw(win, ">> "); } - wprintw(win, "%s %s\n", _(res), _(desc)); + if (all_tunables[i]->good_bad() != TUNE_BAD) + wprintw(win, "%s %s\n", _(res), _(desc)); + else + wprintw(win, "%s %s %s\n", _(res), _(desc), + all_tunables[i]->toggle_script()); } }
Sergey Senozhatsky
Quoted 58 lines · Magnus Fromreide
Quoted 23 lines · Sergey Senozhatsky
report executed
toggle_scriptback to user viaui_notify_user().Example:
Execute: echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
Execute: echo 'on' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';Signed-off-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>--- src/tuning/tuning.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)src/tuning/tuning.cpp +1
-1@@ -141,11 +141,15 @@ void tuning_window::repaint(void) void tuning_window::cursor_enter(void) { class tunable *tun; - + const char *toggle_script; tun = all_tunables[cursor_pos];src/tuning/tuning.cpp void tuning_window::repaint(void) · line 155
Quoted 10 lines
src/tuning/tuning.cpp +4
-0if (!tun) return; + /** device will change its state so need to store toggle script before + * we toggle()*/ + toggle_script = tun->toggle_script(); tun->toggle(); + ui_notify_user("Execute: %s\n", toggle_script); } static bool tunables_sort(class tunable * i, class tunable * j)This only shows the toggle script when you run it, right?
What about the following:
src/tuning/tuning.cpp +5
-1@@ -119,7 +119,11 @@ static void __tuning_update_display(int cursor_pos) wattrset(win, A_REVERSE); wprintw(win, ">> "); } - wprintw(win, "%s %s\n", _(res), _(desc)); + if (all_tunables[i]->good_bad() != TUNE_BAD) + wprintw(win, "%s %s\n", _(res), _(desc)); + else + wprintw(win, "%s %s %s\n", _(res), _(desc), + all_tunables[i]->toggle_script()); } }which shows it in the list of bad tunables.
Quoted 2 lines
Maybe both are useful as my version have the disadvantage of not showing anything after the script is executed.
well, I thought about that and decided to go with "I did X" notification rather than "I will do X". the idea is that user request some action and we report back what we did.
-ss
Quoted 26 lines
/MF
(attached a copy of the patch for easier applying)
src/tuning/tuning.cpp +5
-1@@ -119,7 +119,11 @@ static void __tuning_update_display(int cursor_pos) wattrset(win, A_REVERSE); wprintw(win, ">> "); } - wprintw(win, "%s %s\n", _(res), _(desc)); + if (all_tunables[i]->good_bad() != TUNE_BAD) + wprintw(win, "%s %s\n", _(res), _(desc)); + else + wprintw(win, "%s %s %s\n", _(res), _(desc), + all_tunables[i]->toggle_script()); } }_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop