geforkt von SteamWar/BungeeCore
Fix LoadEvaluation
Dieser Commit ist enthalten in:
Ursprung
ddf06701e8
Commit
5d34cf323f
@ -64,7 +64,7 @@ public class LoadEvaluation {
|
|||||||
|
|
||||||
public static double getCPULoad() {
|
public static double getCPULoad() {
|
||||||
try {
|
try {
|
||||||
Process process = new ProcessBuilder("cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS=\"\" '{printf \"%.2f\\n\", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'").start();
|
Process process = new ProcessBuilder("bash", "-c", "cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS=\"\" '{printf \"%.2f\\n\", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'").start();
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
return Double.parseDouble(new BufferedReader(new InputStreamReader(process.getInputStream())).readLine()) / 100.0;
|
return Double.parseDouble(new BufferedReader(new InputStreamReader(process.getInputStream())).readLine()) / 100.0;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren