Updated regex

This commit is contained in:
Ziver Koc 2015-05-27 13:33:00 +00:00
parent 7d5b412add
commit 4086990c0f
3 changed files with 3 additions and 3 deletions

BIN
Zutil.jar

Binary file not shown.

View file

@ -55,7 +55,7 @@ public class ProcDiskstats {
BufferedReader in = new BufferedReader(new FileReader(PROC_PATH)); BufferedReader in = new BufferedReader(new FileReader(PROC_PATH));
String line = null; String line = null;
while((line=in.readLine()) != null){ while((line=in.readLine()) != null){
String[] str = line.trim().split("\\W+", 4); String[] str = line.trim().split("\\s+", 4);
if(str.length >= 4) { if(str.length >= 4) {
String devName = str[2]; String devName = str[2];
if(!hdds.containsKey(devName)){ if(!hdds.containsKey(devName)){
@ -112,7 +112,7 @@ public class ProcDiskstats {
writeThroughput = new ThroughputCalculator(); writeThroughput = new ThroughputCalculator();
} }
protected void update(String line){ protected void update(String line){
String[] stats = line.split("\\W+"); String[] stats = line.split("\\s+");
if(stats.length >= 11){ if(stats.length >= 11){
readIO = Long.parseLong(stats[0]); readIO = Long.parseLong(stats[0]);
readMerges = Long.parseLong(stats[1]); readMerges = Long.parseLong(stats[1]);

View file

@ -57,7 +57,7 @@ public class ProcStat {
BufferedReader in = new BufferedReader(new FileReader(PROC_PATH)); BufferedReader in = new BufferedReader(new FileReader(PROC_PATH));
String line = null; String line = null;
while((line=in.readLine()) != null){ while((line=in.readLine()) != null){
String[] str = line.split("\\W+"); String[] str = line.split("\\s+");
if(str[0].equals("cpu")) { if(str[0].equals("cpu")) {
cpuTotal.update(str); cpuTotal.update(str);
} }