From 1034ebd6a9d05ed8a5773d066fe585816f53b64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robson=20Alc=C3=A2ntara=20Santana?= Date: Thu, 14 Mar 2019 16:56:07 -0300 Subject: [PATCH] - smoother running --- .../controller/CPUPowerController.java | 29 +++++++++++++------ src/cpupowergui/view/CPUPowerJFrame.form | 2 +- src/cpupowergui/view/CPUPowerJFrame.java | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/cpupowergui/controller/CPUPowerController.java b/src/cpupowergui/controller/CPUPowerController.java index 6bf4efd..92ba92b 100644 --- a/src/cpupowergui/controller/CPUPowerController.java +++ b/src/cpupowergui/controller/CPUPowerController.java @@ -153,14 +153,6 @@ public void setGovernor() { String command = "pkexec sed -i 's/^GOVERNOR=.*/GOVERNOR=\"" + governorString + "\"/' /etc/init.d/cpufrequtils"; Process pr = rt.exec(new String[] { "bash", "-c", command}); -// command = "pkexec grep -v '#' /etc/init.d/cpufrequtils | awk -F \"=\" '/GOVERNOR=/ {print $2;}'"; -// pr = rt.exec(new String[] { "bash", "-c", command}); - - if( governor != Governor.ONDEMAND ) { - command = "pkexec systemctl disable ondemand"; - pr = rt.exec(new String[] { "bash", "-c", command}); - } - String output; final ProcessResultReader stderr = new ProcessResultReader(pr.getErrorStream(), "STDERR"); @@ -171,7 +163,26 @@ public void setGovernor() { final ProcessResultReader stdout = new ProcessResultReader(pr.getErrorStream(), "STDOUT"); stdout.run(); output = stdout.toString(); - System.out.println(output); + System.out.println(output); + +// command = "pkexec grep -v '#' /etc/init.d/cpufrequtils | awk -F \"=\" '/GOVERNOR=/ {print $2;}'"; +// pr = rt.exec(new String[] { "bash", "-c", command}); + + if( governor != Governor.ONDEMAND ) { + command = "pkexec systemctl disable ondemand"; + pr = rt.exec(new String[] { "bash", "-c", command}); + + final ProcessResultReader stderr2 = new ProcessResultReader(pr.getErrorStream(), "STDERR"); + stderr2.run(); + output = stderr2.toString(); + System.out.println(output); + + final ProcessResultReader stdout2 = new ProcessResultReader(pr.getErrorStream(), "STDOUT"); + stdout2.run(); + output = stdout2.toString(); + System.out.println(output); + } + JOptionPane.showMessageDialog(cpuPowerJFrame, "Governor permanently altered","Message",JOptionPane.INFORMATION_MESSAGE); } catch (IOException ex) { Logger.getLogger(CPUPowerController.class.getName()).log(Level.SEVERE, null, ex); diff --git a/src/cpupowergui/view/CPUPowerJFrame.form b/src/cpupowergui/view/CPUPowerJFrame.form index ae71cc8..26dcb8e 100644 --- a/src/cpupowergui/view/CPUPowerJFrame.form +++ b/src/cpupowergui/view/CPUPowerJFrame.form @@ -181,7 +181,7 @@ - + diff --git a/src/cpupowergui/view/CPUPowerJFrame.java b/src/cpupowergui/view/CPUPowerJFrame.java index 8342d7a..316a6e0 100644 --- a/src/cpupowergui/view/CPUPowerJFrame.java +++ b/src/cpupowergui/view/CPUPowerJFrame.java @@ -74,7 +74,7 @@ private void initComponents() { buttonGroup1.add(jRadioButton5); jRadioButton5.setText("userspace"); - jCheckBox1.setText("fixed"); + jCheckBox1.setText("persistent"); jButton1.setText("reconfigure"); jButton1.addActionListener(new java.awt.event.ActionListener() {