Ny buggfix för #6
Showing
5 changed files
with
18 additions
and
14 deletions
No preview for this file type
No preview for this file type
No preview for this file type
... | @@ -26,23 +26,29 @@ class LongDelta { | ... | @@ -26,23 +26,29 @@ class LongDelta { |
26 | } | 26 | } |
27 | public void update(ResultSet rset, int pos, boolean convert, boolean close) throws Throwable{ | 27 | public void update(ResultSet rset, int pos, boolean convert, boolean close) throws Throwable{ |
28 | rset.next(); | 28 | rset.next(); |
29 | long newval = rset.getLong(pos); | 29 | update(rset.getLong(pos), rset.getTimestamp(1), convert); |
30 | if(convert) newval = newval/1000; | 30 | if(close) rset.close(); |
31 | } | ||
32 | |||
33 | public void update(long value, Timestamp timestamp) { | ||
34 | update(value, timestamp, false); | ||
35 | } | ||
36 | |||
37 | public void update(Long value, Timestamp timestamp, boolean convert) { | ||
38 | if(convert) value = value/1000; | ||
31 | if(urProt) { | 39 | if(urProt) { |
32 | if(this.curValue != null && this.curValue > newval) { | 40 | if(this.curValue != null && this.curValue > value) { |
33 | //This would be a negative delta. Ignore this data | 41 | //This would be a negative delta. Ignore this data |
34 | //System.out.println("Underrunprotection on " + name + " New Val: " + newval + " Old Val: " + this.curValue); | 42 | //System.out.println("Underrunprotection on " + name + " New Val: " + newval + " Old Val: " + this.curValue); |
35 | lastUpdCausedUR = true; | 43 | lastUpdCausedUR = true; |
36 | if(close) rset.close(); | ||
37 | return; | 44 | return; |
38 | } | 45 | } |
39 | } | 46 | } |
40 | this.lastFetch = this.curFetch; | 47 | this.lastFetch = this.curFetch; |
41 | this.curFetch = rset.getTimestamp(1); | 48 | this.curFetch = timestamp; |
42 | this.lastValue = this.curValue; | 49 | this.lastValue = this.curValue; |
43 | this.curValue = newval; | 50 | this.curValue = value; |
44 | lastUpdCausedUR = false; | 51 | lastUpdCausedUR = false; |
45 | if(close) rset.close(); | ||
46 | } | 52 | } |
47 | 53 | ||
48 | public boolean didLastUnderRun() { | 54 | public boolean didLastUnderRun() { | ... | ... |
... | @@ -211,7 +211,6 @@ public class OraMon { | ... | @@ -211,7 +211,6 @@ public class OraMon { |
211 | open(); | 211 | open(); |
212 | } | 212 | } |
213 | Statement stmt = conn.createStatement(); | 213 | Statement stmt = conn.createStatement(); |
214 | Statement scrollStmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); | ||
215 | ResultSet rset = null; | 214 | ResultSet rset = null; |
216 | 215 | ||
217 | //Get the database name once | 216 | //Get the database name once |
... | @@ -229,12 +228,11 @@ public class OraMon { | ... | @@ -229,12 +228,11 @@ public class OraMon { |
229 | this.numCpus = (int) colOsStat.getCurrentValue("NUM_CPUS"); | 228 | this.numCpus = (int) colOsStat.getCurrentValue("NUM_CPUS"); |
230 | 229 | ||
231 | // Get DB CPU use time | 230 | // Get DB CPU use time |
232 | 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'"); | 231 | 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'"); |
233 | cpuTime.update(rset, 3, false, false); | 232 | rset.next(); |
234 | rset.beforeFirst(); | 233 | niwTime.update(rset.getLong(2), rset.getTimestamp(1)); |
235 | niwTime.update(rset, 2, false); | 234 | cpuTime.update(rset.getLong(3), rset.getTimestamp(1)); |
236 | rset.close(); | 235 | rset.close(); |
237 | scrollStmt.close(); | ||
238 | 236 | ||
239 | // cpuTime.update(stmt.executeQuery("select systimestamp, value from V$SYS_TIME_MODEL where stat_name='DB CPU'")); | 237 | // cpuTime.update(stmt.executeQuery("select systimestamp, value from V$SYS_TIME_MODEL where stat_name='DB CPU'")); |
240 | // niwTime.update(stmt.executeQuery("select systimestamp, value from V$SYSSTAT where name='non-idle wait time'")); | 238 | // niwTime.update(stmt.executeQuery("select systimestamp, value from V$SYSSTAT where name='non-idle wait time'")); | ... | ... |
-
Please register or sign in to post a comment