Commit 505f3c8c 505f3c8cb06d0ef19c42f23460df2aef44836c3a by Christian Gerdes

Ny buggfix för #6

1 parent f51d29df
No preview for this file type
......@@ -26,23 +26,29 @@ class LongDelta {
}
public void update(ResultSet rset, int pos, boolean convert, boolean close) throws Throwable{
rset.next();
long newval = rset.getLong(pos);
if(convert) newval = newval/1000;
update(rset.getLong(pos), rset.getTimestamp(1), convert);
if(close) rset.close();
}
public void update(long value, Timestamp timestamp) {
update(value, timestamp, false);
}
public void update(Long value, Timestamp timestamp, boolean convert) {
if(convert) value = value/1000;
if(urProt) {
if(this.curValue != null && this.curValue > newval) {
if(this.curValue != null && this.curValue > value) {
//This would be a negative delta. Ignore this data
//System.out.println("Underrunprotection on " + name + " New Val: " + newval + " Old Val: " + this.curValue);
lastUpdCausedUR = true;
if(close) rset.close();
lastUpdCausedUR = true;
return;
}
}
this.lastFetch = this.curFetch;
this.curFetch = rset.getTimestamp(1);
this.curFetch = timestamp;
this.lastValue = this.curValue;
this.curValue = newval;
this.curValue = value;
lastUpdCausedUR = false;
if(close) rset.close();
}
public boolean didLastUnderRun() {
......
......@@ -211,7 +211,6 @@ public class OraMon {
open();
}
Statement stmt = conn.createStatement();
Statement scrollStmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rset = null;
//Get the database name once
......@@ -229,12 +228,11 @@ public class OraMon {
this.numCpus = (int) colOsStat.getCurrentValue("NUM_CPUS");
// Get DB CPU use time
rset = scrollStmt.executeQuery("select systimestamp, s.value as NIWT, t.value as DBCPU from V$SYSSTAT s, V$SYS_TIME_MODEL t where s.name='non-idle wait time' and t.STAT_NAME='DB CPU'");
cpuTime.update(rset, 3, false, false);
rset.beforeFirst();
niwTime.update(rset, 2, false);
rset = stmt.executeQuery("select systimestamp, s.value as NIWT, t.value as DBCPU from V$SYSSTAT s, V$SYS_TIME_MODEL t where s.name='non-idle wait time' and t.STAT_NAME='DB CPU'");
rset.next();
niwTime.update(rset.getLong(2), rset.getTimestamp(1));
cpuTime.update(rset.getLong(3), rset.getTimestamp(1));
rset.close();
scrollStmt.close();
// cpuTime.update(stmt.executeQuery("select systimestamp, value from V$SYS_TIME_MODEL where stat_name='DB CPU'"));
// niwTime.update(stmt.executeQuery("select systimestamp, value from V$SYSSTAT where name='non-idle wait time'"));
......