Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Products
/
LILOM
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
2
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
56b16db9
...
56b16db97bfffe0976f0329dfdbd668baa027186
authored
2018-04-25 17:56:41 +0200
by
Christian Gerdes
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bytt till att läsa in som BigDecimal i LongDelta klassen istället.
1 parent
6f1bcf88
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
18 deletions
JavaMonWeb/WebContent/WEB-INF/lib/lilom.jar
JavaMonWeb/jetty/JavaMonWeb.war
LILOM Library/se/lil/om/Collector.java
LILOM Library/se/lil/om/LongDelta.java
LILOM Library/se/lil/om/OraMon.java
JavaMonWeb/WebContent/WEB-INF/lib/lilom.jar
View file @
56b16db
No preview for this file type
JavaMonWeb/jetty/JavaMonWeb.war
View file @
56b16db
No preview for this file type
LILOM Library/se/lil/om/Collector.java
View file @
56b16db
package
se
.
lil
.
om
;
import
java.math.BigDecimal
;
import
java.sql.ResultSet
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
...
...
@@ -12,19 +13,19 @@ class Collector {
// Add try catch for issue #5
Timestamp
ts
=
rset
.
getTimestamp
(
1
);
String
name
=
rset
.
getString
(
2
);
Long
value
;
BigDecimal
value
;
try
{
value
=
rset
.
get
Long
(
3
);
value
=
rset
.
get
BigDecimal
(
3
);
}
catch
(
java
.
sql
.
SQLException
e
)
{
value
=
Long
.
MAX_VALUE
;
value
=
BigDecimal
.
ZERO
;
}
updateValue
(
ts
,
name
,
value
);
}
rset
.
close
();
}
public
void
updateValue
(
Timestamp
ts
,
String
name
,
Long
value
)
{
public
void
updateValue
(
Timestamp
ts
,
String
name
,
BigDecimal
value
)
{
LongDelta
myDelta
=
null
;
for
(
int
x
=
0
;
x
<
list
.
size
()
&&
myDelta
==
null
;
x
++)
{
if
(
name
.
equals
(
list
.
get
(
x
).
name
))
{
...
...
LILOM Library/se/lil/om/LongDelta.java
View file @
56b16db
package
se
.
lil
.
om
;
import
java.math.BigDecimal
;
import
java.sql.ResultSet
;
import
java.sql.Timestamp
;
class
LongDelta
{
public
String
name
=
null
;
public
Long
curValue
=
null
;
public
Long
lastValue
=
null
;
public
BigDecimal
curValue
=
null
;
public
BigDecimal
lastValue
=
null
;
public
Timestamp
lastFetch
=
null
;
public
Timestamp
curFetch
=
null
;
boolean
urProt
=
false
;
// Under-run protection
boolean
lastUpdCausedUR
=
false
;
public
static
BigDecimal
bd1000
=
new
BigDecimal
(
1000
);
public
LongDelta
()
{};
public
LongDelta
(
boolean
UnderrunProtection
)
{
this
.
urProt
=
UnderrunProtection
;
}
...
...
@@ -26,18 +28,18 @@ class LongDelta {
}
public
void
update
(
ResultSet
rset
,
int
pos
,
boolean
convert
,
boolean
close
)
throws
Throwable
{
rset
.
next
();
update
(
rset
.
get
Long
(
pos
),
rset
.
getTimestamp
(
1
),
convert
);
update
(
rset
.
get
BigDecimal
(
pos
),
rset
.
getTimestamp
(
1
),
convert
);
if
(
close
)
rset
.
close
();
}
public
void
update
(
long
value
,
Timestamp
timestamp
)
{
public
void
update
(
BigDecimal
value
,
Timestamp
timestamp
)
{
update
(
value
,
timestamp
,
false
);
}
public
void
update
(
long
value
,
Timestamp
timestamp
,
boolean
convert
)
{
if
(
convert
)
value
=
value
/
1000
;
public
void
update
(
BigDecimal
value
,
Timestamp
timestamp
,
boolean
convert
)
{
if
(
convert
)
value
=
value
.
divide
(
bd1000
,
BigDecimal
.
ROUND_HALF_UP
)
;
if
(
urProt
)
{
if
(
this
.
curValue
!=
null
&&
this
.
curValue
>
value
)
{
if
(
this
.
curValue
!=
null
&&
this
.
curValue
.
compareTo
(
value
)
>
0
)
{
//This would be a negative delta. Ignore this data
//System.out.println("Underrunprotection on " + name + " New Val: " + newval + " Old Val: " + this.curValue);
lastUpdCausedUR
=
true
;
...
...
@@ -59,7 +61,7 @@ class LongDelta {
if
(
this
.
curValue
!=
null
&&
this
.
lastValue
!=
null
&&
this
.
lastFetch
!=
null
&&
this
.
curFetch
!=
null
)
{
// We have values, calculate the number of gets per second
double
numMilliSeconds
=
this
.
curFetch
.
getTime
()
-
this
.
lastFetch
.
getTime
();
double
delta
=
this
.
curValue
-
this
.
lastValue
;
double
delta
=
this
.
curValue
.
subtract
(
this
.
lastValue
).
doubleValue
()
;
double
perMilli
=
delta
/
numMilliSeconds
;
return
perMilli
*
1000
;
}
else
{
...
...
@@ -67,7 +69,7 @@ class LongDelta {
}
}
public
long
getCurrentValue
()
throws
Throwable
{
if
(
this
.
curValue
!=
null
)
return
this
.
curValue
;
if
(
this
.
curValue
!=
null
)
return
this
.
curValue
.
longValue
()
;
else
return
0
;
}
public
double
getSeconds
()
throws
Throwable
{
...
...
@@ -85,7 +87,7 @@ class LongDelta {
}
public
long
getDelta
()
throws
Throwable
{
if
(
this
.
lastValue
!=
null
&&
this
.
curValue
!=
null
)
{
return
this
.
curValue
-
this
.
lastValue
;
return
this
.
curValue
.
subtract
(
this
.
lastValue
).
longValue
()
;
}
return
0
;
}
...
...
LILOM Library/se/lil/om/OraMon.java
View file @
56b16db
...
...
@@ -396,8 +396,8 @@ public class OraMon {
// Get DB CPU use time
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
.
get
Long
(
2
),
rset
.
getTimestamp
(
1
));
cpuTime
.
update
(
rset
.
get
Long
(
3
),
rset
.
getTimestamp
(
1
));
niwTime
.
update
(
rset
.
get
BigDecimal
(
2
),
rset
.
getTimestamp
(
1
));
cpuTime
.
update
(
rset
.
get
BigDecimal
(
3
),
rset
.
getTimestamp
(
1
));
rset
.
close
();
//Get the entire V_$SYSSTAT table from DB
...
...
@@ -411,8 +411,8 @@ public class OraMon {
while
(
rset
.
next
())
{
Timestamp
ts
=
rset
.
getTimestamp
(
1
);
String
name
=
rset
.
getString
(
2
);
colPdbCPU
.
updateValue
(
ts
,
name
+
strNiwTime
,
rset
.
get
Long
(
3
));
colPdbCPU
.
updateValue
(
ts
,
name
+
strCpuTime
,
rset
.
get
Long
(
4
));
colPdbCPU
.
updateValue
(
ts
,
name
+
strNiwTime
,
rset
.
get
BigDecimal
(
3
));
colPdbCPU
.
updateValue
(
ts
,
name
+
strCpuTime
,
rset
.
get
BigDecimal
(
4
));
if
(
pdbSet
==
null
)
pdbSet
=
new
HashSet
<
String
>();
pdbSet
.
add
(
name
);
}
...
...
Please
register
or
sign in
to post a comment