Commit 120dfc5a 120dfc5a0acb9e91856dc16bfedbd375dcba698d by Christian Gerdes

Initial commit

0 parents
/*
* LoadRunner Java script. (Build: _build_number_)
*
* Script Description:
*
*/
import java.util.ArrayList;
import lrapi.lr;
import se.lil.om.*;
public class Actions
{
ArrayList<OraMon> oraList = new ArrayList<OraMon>();
boolean firstIteration = true;
String empty = "";
public int init() throws Throwable
{
if(lr.get_attrib_string("ConnectionString") == null || lr.get_attrib_string("User") == null || lr.get_attrib_string("Password") == null ||
lr.get_attrib_string("ConnectionString").equals(empty) || lr.get_attrib_string("User").equals(empty) || lr.get_attrib_string("Password").equals(empty))
{
lr.error_message("Attributes are missing for Oracle: ConnectionString, User or Password are null. Nothing to do, aborting vuser.");
lr.exit(lr.EXIT_VUSER, lr.FAIL);
}
String[] conS = lr.get_attrib_string("ConnectionString").split(",");
String[] usrS = lr.get_attrib_string("User").split(",");
String[] pasS = lr.get_attrib_string("Password").split(",");
if(conS.length != usrS.length || conS.length != pasS.length)
{
lr.error_message("Oracle has multiple comma separated connection strings but not the same number of multiple user or password strings. Cannot continue, abort.");
lr.exit(lr.EXIT_VUSER, lr.FAIL);
}
for(int x=0; x<conS.length; x++)
{
OraMon mon = new OraMon();
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG , " Using " + conS[x].trim() + " User " + usrS[x].trim() + " Pass " + pasS[x].trim());
mon.open(conS[x].trim(), usrS[x].trim(), pasS[x].trim());
oraList.add(mon);
}
return 0;
}//end of init
public int action() throws Throwable
{
for(OraMon oracle : oraList)
{
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG , "#### ORACLE COUNTERS ####");
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG, "Using: " + oracle.getConString());
oracle.getData();
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG, "Returned DB Name: " + oracle.getDBName());
if(firstIteration == false)
{
String instance = oracle.getDBName();
sendDataPoint("ORA Cpus (#) " + instance, oracle.getNumberOfCPUs());
sendDataPoint("ORA Cpu Time (ms/s) " + instance, oracle.getCPUTimePerSecond());
sendDataPoint("ORA Cpu Usage (%) " + instance, oracle.getCPUPercent());
sendDataPoint("ORA Logical Reads (#/s) " + instance, oracle.getLogicalReadsPerSecond());
sendDataPoint("ORA Consistent Gets (#/s) " + instance, oracle.getPerSecondValue("consistent gets"));
sendDataPoint("ORA DB Block Gets (#/s) " + instance, oracle.getPerSecondValue("db block gets"));
sendDataPoint("ORA Cache Hit Ratio (%) " + instance, oracle.getCacheHitRatioPercent());
sendDataPoint("ORA Buffer Cache Hit Ratio (%) " + instance, oracle.getBufferCacheHitRatioPercent());
sendDataPoint("ORA DB Block Changes (#/s) " + instance, oracle.getPerSecondValue("db block changes"));
sendDataPoint("ORA Redo Size (#/s) " + instance, oracle.getPerSecondValue("redo size"));
sendDataPoint("ORA Physical Reads (#/s) " + instance, oracle.getPerSecondValue("physical reads"));
sendDataPoint("ORA Physical Writes (#/s) " + instance, oracle.getPerSecondValue("physical writes"));
sendDataPoint("ORA Redo Writes (#/s) " + instance, oracle.getPerSecondValue("redo writes"));
sendDataPoint("ORA Non-idle Wait Time (ms/s) " + instance, oracle.getPerSecondValue("non-idle wait time"));
sendDataPoint("ORA File I/O Wait Time (ms/s) " + instance, oracle.getPerSecondValue("file io wait time"));
sendDataPoint("ORA Executes (#/s) " + instance, oracle.getPerSecondValue("execute count"));
sendDataPoint("ORA User Calls (#/s) " + instance, oracle.getPerSecondValue("user calls"));
sendDataPoint("ORA User Commits (#/s) " + instance, oracle.getPerSecondValue("user commits"));
sendDataPoint("ORA User Rollbacks (#/s) " + instance, oracle.getPerSecondValue("user rollbacks"));
sendDataPoint("ORA Parse Count Total (#/s) " + instance, oracle.getPerSecondValue("parse count (total)"));
sendDataPoint("ORA Parse Count Hard (#/s) " + instance, oracle.getPerSecondValue("parse count (hard)"));
} else {
firstIteration = false;
}
}
return 0;
}//end of action
public int end() throws Throwable
{
for(OraMon oracle : oraList)
{
oracle.close();
}
return 0;
}//end of end
// Needed to avoid LR12 VuGen from hanging in a CPU loop (later fixed by a patch but just in case)
public void sendDataPoint(String name, double value)
{
lr.user_data_point(name, value);
}
}
/*
* LoadRunner Java script. (Build: _build_number_)
*
* Script Description:
*
*/
import java.util.ArrayList;
import lrapi.lr;
import se.lil.om.*;
public class Actions
{
ArrayList<OraMon> oraList = new ArrayList<OraMon>();
boolean firstIteration = true;
String empty = "";
public int init() throws Throwable
{
if(lr.get_attrib_string("ConnectionString") == null || lr.get_attrib_string("User") == null || lr.get_attrib_string("Password") == null ||
lr.get_attrib_string("ConnectionString").equals(empty) || lr.get_attrib_string("User").equals(empty) || lr.get_attrib_string("Password").equals(empty))
{
lr.error_message("Attributes are missing for Oracle: ConnectionString, User or Password are null. Nothing to do, aborting vuser.");
lr.exit(lr.EXIT_VUSER, lr.FAIL);
}
String[] conS = lr.get_attrib_string("ConnectionString").split(",");
String[] usrS = lr.get_attrib_string("User").split(",");
String[] pasS = lr.get_attrib_string("Password").split(",");
if(conS.length != usrS.length || conS.length != pasS.length)
{
lr.error_message("Oracle has multiple comma separated connection strings but not the same number of multiple user or password strings. Cannot continue, abort.");
lr.exit(lr.EXIT_VUSER, lr.FAIL);
}
for(int x=0; x<conS.length; x++)
{
OraMon mon = new OraMon();
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG , " Using " + conS[x].trim() + " User " + usrS[x].trim() + " Pass " + pasS[x].trim());
mon.open(conS[x].trim(), usrS[x].trim(), pasS[x].trim());
oraList.add(mon);
}
return 0;
}////end of init
public int action() throws Throwable
{
for(OraMon oracle : oraList)
{
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG , "#### ORACLE COUNTERS ####");
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG, "Using: " + oracle.getConString());
oracle.getData();
lr.debug_message (lr.MSG_CLASS_EXTENDED_LOG, "Returned DB Name: " + oracle.getDBName());
if(firstIteration == false)
{
String instance = oracle.getDBName();
sendDataPoint("ORA Cpus (#) " + instance, oracle.getNumberOfCPUs());
sendDataPoint("ORA Cpu Time (ms/s) " + instance, oracle.getCPUTimePerSecond());
sendDataPoint("ORA Cpu Usage (%) " + instance, oracle.getCPUPercent());
sendDataPoint("ORA Logical Reads (#/s) " + instance, oracle.getLogicalReadsPerSecond());
sendDataPoint("ORA Consistent Gets (#/s) " + instance, oracle.getPerSecondValue("consistent gets"));
sendDataPoint("ORA DB Block Gets (#/s) " + instance, oracle.getPerSecondValue("db block gets"));
sendDataPoint("ORA Cache Hit Ratio (%) " + instance, oracle.getCacheHitRatioPercent());
sendDataPoint("ORA Buffer Cache Hit Ratio (%) " + instance, oracle.getBufferCacheHitRatioPercent());
sendDataPoint("ORA DB Block Changes (#/s) " + instance, oracle.getPerSecondValue("db block changes"));
sendDataPoint("ORA Redo Size (#/s) " + instance, oracle.getPerSecondValue("redo size"));
sendDataPoint("ORA Physical Reads (#/s) " + instance, oracle.getPerSecondValue("physical reads"));
sendDataPoint("ORA Physical Writes (#/s) " + instance, oracle.getPerSecondValue("physical writes"));
sendDataPoint("ORA Redo Writes (#/s) " + instance, oracle.getPerSecondValue("redo writes"));
sendDataPoint("ORA Non-idle Wait Time (ms/s) " + instance, oracle.getPerSecondValue("non-idle wait time"));
sendDataPoint("ORA File I/O Wait Time (ms/s) " + instance, oracle.getPerSecondValue("file io wait time"));
sendDataPoint("ORA Executes (#/s) " + instance, oracle.getPerSecondValue("execute count"));
sendDataPoint("ORA User Calls (#/s) " + instance, oracle.getPerSecondValue("user calls"));
sendDataPoint("ORA User Commits (#/s) " + instance, oracle.getPerSecondValue("user commits"));
sendDataPoint("ORA User Rollbacks (#/s) " + instance, oracle.getPerSecondValue("user rollbacks"));
sendDataPoint("ORA Parse Count Total (#/s) " + instance, oracle.getPerSecondValue("parse count (total)"));
sendDataPoint("ORA Parse Count Hard (#/s) " + instance, oracle.getPerSecondValue("parse count (hard)"));
} else {
firstIteration = false;
}
}
return 0;
}////end of action
public int end() throws Throwable
{
for(OraMon oracle : oraList)
{
oracle.close();
}
return 0;
}////end of end
// Needed to avoid LR12 VuGen from hanging in a CPU loop (later fixed by a patch but just in case)
public void sendDataPoint(String name, double value)
{
lr.user_data_point(name, value);
}
}
[General]
Type=General-Java
RecordedProtocol=
DefaultCfg=default.cfg
AppName=
BuildTarget=
ParamRightBrace=>
ParamLeftBrace=<
NewFunctionHeader=1
LastActiveAction=Actions
CorrInfoReportDir=
LastResultDir=
DevelopTool=Vugen
ActionLogicExt=action_logic
MajorVersion=12
MinorVersion=50
ParameterFile=
GlobalParameterFile=
RunType=Java-Interpreter
LastModifyVer=12.50.0.0
AdditionalTypes=General-Java
GenerateTypes=
ActiveTypes=
ScriptLanguage=JAVA
DisableRegenerate=0
Description=
[TransactionsOrder]
Order=
[Actions]
vuser_init=vuser_init.java
Actions=Actions.java
vuser_end=vuser_end.java
[ProtocolsVersion]
General-Java=11.0.0.0
[RunLogicFiles]
Default Profile=default.usp
[StateManagement]
1=1
4=0
9=0
10=0
11=0
12=0
17=0
18=0
20=0
21=0
CurrentState=1
VuserStateHistory=0 65536 65552
LastReplayStatus=2
[ActiveReplay]
LastReplayedRunName=result1
ActiveRunName=result1
[Recorded Actions]
vuser_init=0
Actions=0
vuser_end=0
[Replayed Actions]
vuser_init=1
Actions=1
vuser_end=1
[Modified Actions]
vuser_init=0
Actions=1
vuser_end=0
[ManuallyExtraFiles]
lilom.jar=
ojdbc6.jar=
[Interpreters]
vuser_init=Java-Interpreter
Actions=Java-Interpreter
vuser_end=Java-Interpreter
[General]
XlBridgeTimeout=120
DefaultRunLogic=default.usp
iter_begins_val=fixed
iter_ends_val=fixed
ContinueOnError=0
FailTransOnErrorMsg=0
AutomaticTransactions=0
UseThreads=1
[ThinkTime]
Options=NOTHINK
Factor=1.000000
LimitFlag=0
Limit=1
ThinkTimeRandomLow=50
ThinkTimeRandomHigh=150
[Iterations]
NumOfIterations=1
IterationPace=IterationASAP
StartEvery=60
RandomMin=60
RandomMax=90
[Log]
LogOptions=LogExtended
MsgClassData=0
MsgClassParameters=0
MsgClassFull=0
AutoLog=0
PrintTimeStamp=0
[CommandArguments]
ConnectionString=jdbc:oracle:thin:@host:port:sid
~ConnectionString=Tex "jdbc:oracle:thin:@host:port:sid"
User=system
~User=Tex "oracleuser"
Password=passw0rd
~Password=
[JavaVM:Options]
Java_Env_ClassPath=ojdbc6.jar;se.ttm.tdemon.jar;
Java_Env_ClassPath_Unused=
Java_Previous_Class_Path=
use_jdk=search_jdk
jdk_home=
Java_VM_Params=
Use_Xboot=0
enable_CL_per_vuser=0
[ModemSpeed]
EnableModemSpeed=0
EnableCustomModemSpeed=0
ModemSpeed=128000
CustomModemSpeed=1000
[RunLogicEndRoot:vuser_end]
MercIniTreeSectionName="vuser_end"
RunLogicObjectKind="Action"
Name="vuser_end"
RunLogicInterpreterType="Java-Interpreter"
MercIniTreeFather="RunLogicEndRoot"
RunLogicActionType="VuserEnd"
[RunLogicInitRoot:vuser_init]
MercIniTreeSectionName="vuser_init"
RunLogicObjectKind="Action"
Name="vuser_init"
RunLogicInterpreterType="Java-Interpreter"
MercIniTreeFather="RunLogicInitRoot"
RunLogicActionType="VuserInit"
[RunLogicRunRoot:Actions]
MercIniTreeSectionName="Actions"
RunLogicObjectKind="Action"
Name="Actions"
RunLogicInterpreterType="Java-Interpreter"
MercIniTreeFather="RunLogicRunRoot"
RunLogicActionType="VuserRun"
[Profile Actions]
Profile Actions name=vuser_init,Actions,vuser_end
MercIniTreeSectionName="Profile Actions"
MercIniTreeFather=""
[RunLogicRunRoot]
RunLogicPaceConstTime="60,000"
RunLogicRandomPaceMax="90,000"
RunLogicActionOrder="Actions"
RunLogicAfterPaceMax="90,000"
MercIniTreeFather=""
RunLogicPaceType="ConstAfter"
MercIniTreeSons="Actions"
RunLogicNumOfIterations="2"
Name="Run"
RunLogicAfterPaceMin="60,000"
RunLogicRunMode="Sequential"
RunLogicPaceConstAfterTime="15,000"
RunLogicObjectKind="Group"
RunLogicActionType="VuserRun"
RunLogicRandomPaceMin="60,000"
MercIniTreeSectionName="RunLogicRunRoot"
[RunLogicEndRoot]
RunLogicActionOrder="vuser_end"
MercIniTreeFather=""
MercIniTreeSons="vuser_end"
RunLogicNumOfIterations="1"
Name="End"
RunLogicRunMode="Sequential"
RunLogicObjectKind="Group"
RunLogicActionType="VuserEnd"
MercIniTreeSectionName="RunLogicEndRoot"
[RunLogicInitRoot]
RunLogicActionOrder="vuser_init"
MercIniTreeFather=""
MercIniTreeSons="vuser_init"
RunLogicNumOfIterations="1"
Name="Init"
RunLogicRunMode="Sequential"
RunLogicObjectKind="Group"
RunLogicActionType="VuserInit"
MercIniTreeSectionName="RunLogicInitRoot"
No preview for this file type
No preview for this file type
No preview for this file type
// Do not change this file
// Do not change this file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry exported="true" kind="lib" path="lib/ojdbc6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ojdbc5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path=""/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LILOM Library</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
No preview for this file type
No preview for this file type
package se.lil.om;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
class Collector {
ArrayList<LongDelta> list = new ArrayList<LongDelta>();
public void update(ResultSet rset) throws Throwable {
while(rset.next()) {
updateValue(rset.getTimestamp(1), rset.getString(2), rset.getLong(3));
}
rset.close();
}
public void updateValue(Timestamp ts, String name, Long value) {
LongDelta myDelta = null;
for(int x = 0; x<list.size() && myDelta == null; x++) {
if(name.equals(list.get(x).name)) {
myDelta = list.get(x);
}
}
if(myDelta != null) {
myDelta.lastFetch = myDelta.curFetch;
myDelta.curFetch = ts;
myDelta.lastValue = myDelta.curValue;
myDelta.curValue = value;
} else {
myDelta = new LongDelta();
myDelta.curFetch = ts;
myDelta.curValue = value;
myDelta.name = name;
list.add(myDelta);
}
}
public long getPerSecValue(String name) throws Throwable {
LongDelta myDelta = null;
for(int x = 0; x<list.size() && myDelta == null; x++) {
if(name.equals(list.get(x).name)) {
myDelta = list.get(x);
}
}
if(myDelta != null)
return myDelta.getPerSecondValue();
else
return 0;
}
}
\ No newline at end of file
package se.lil.om;
import java.sql.ResultSet;
import java.sql.Timestamp;
class LongDelta {
public String name = null;
public Long curValue = null;
public Long lastValue = null;
public Timestamp lastFetch = null;
public Timestamp curFetch = null;
public void update(ResultSet rset) throws Throwable{
update(rset, false);
}
public void update(ResultSet rset, boolean convert) throws Throwable{
rset.next();
this.lastFetch = this.curFetch;
this.curFetch = rset.getTimestamp(1);
this.lastValue = this.curValue;
if(convert)
this.curValue = rset.getLong(2)/1000;
else
this.curValue = rset.getLong(2);
rset.close();
}
public long getPerSecondValue() throws Throwable {
if(this.curValue != null && this.lastValue != null && this.lastFetch != null && this.curFetch != null) {
// We have values, calculate the number of gets per second
long numSeconds = (this.curFetch.getTime() - this.lastFetch.getTime()) / 1000;
long delta = this.curValue - this.lastValue;
return delta/numSeconds;
} else {
return 0;
}
}
public long getSeconds() throws Throwable {
if(this.lastFetch != null && this.curFetch != null) {
long numSeconds = (this.curFetch.getTime() - this.lastFetch.getTime()) / 1000;
return numSeconds;
}
return 0;
}
}
\ No newline at end of file
package se.lil.om;
import java.sql.*;
public class OraMon {
Connection conn = null;
String conString = "jdbc:oracle:thin:@//hostname:1521/SID";
String conUser = "system";
String conPass = "passw0rd";
String dbName = null;
Collector col = new Collector();
public String getConString() {
return this.conString;
}
//NUM_CPUS
int numCpus = 0;
public long getNumberOfCPUs() throws Throwable {
return numCpus;
}
//DB CPU
LongDelta cpuTime = new LongDelta();
public double getCPUPercent() throws Throwable {
double perSec = cpuTime.getPerSecondValue();
double totSec = numCpus * 1000;
double percent = (perSec / totSec) * 100;
return percent;
}
public long getCPUTimePerSecond() throws Throwable {
return cpuTime.getPerSecondValue();
}
public long getPerSecondValue(String name) throws Throwable {
return col.getPerSecValue(name);
}
public String getDBName() throws Throwable {
return this.dbName;
}
public double getBufferCacheHitRatioPercent() throws Throwable {
double conGetsCache = getPerSecondValue("consistent gets from cache");
double dbBlocksCache = getPerSecondValue("db block gets from cache");
double physReadsCache = getPerSecondValue("physical reads cache");
if (conGetsCache + dbBlocksCache + physReadsCache == 0) {
return 100;
}
if (conGetsCache + dbBlocksCache == 0 && physReadsCache > 0) {
return 0;
}
double buffCacheHitRatio = 1 - (physReadsCache/(conGetsCache + dbBlocksCache));
return buffCacheHitRatio * 100;
}
public double getCacheHitRatioPercent() throws Throwable {
double conGets = getPerSecondValue("consistent gets");
double dbBlocks = getPerSecondValue("db block gets");
double physReads = getPerSecondValue("physical reads");
if (conGets + dbBlocks + physReads == 0) {
return 100;
}
if (conGets + dbBlocks == 0 && physReads > 0) {
return 0;
}
double cacheHitRatio = 1 - (physReads/(conGets + dbBlocks));
return cacheHitRatio * 100;
}
public long getLogicalReadsPerSecond() throws Throwable {
return getPerSecondValue("consistent gets") + getPerSecondValue("db block gets");
}
public void getData() throws Throwable {
Statement stmt = conn.createStatement();
ResultSet rset = null;
//Get the database name once
if(this.dbName == null) {
rset = stmt.executeQuery("select value from V$SYSTEM_PARAMETER where name = 'db_name'");
rset.next();
this.dbName = rset.getString(1);
rset.close();
}
//Get values for CPU calculation
rset = stmt.executeQuery("select value from V$OSSTAT where STAT_NAME = 'NUM_CPUS'");
rset.next();
this.numCpus = rset.getInt(1);
rset.close();
cpuTime.update(stmt.executeQuery("select systimestamp, value from V$SYS_TIME_MODEL where stat_name='DB CPU'"), true);
// Get the entire V_$SYSSTAT table from DB
col.update(stmt.executeQuery("select systimestamp, name, value from V$SYSSTAT"));
stmt.close();
}
public OraMon() {
// TODO Auto-generated constructor stub
}
public OraMon(String con, String user, String pass) {
this.conString = con;
this.conUser = user;
this.conPass = pass;
}
public void open() throws Throwable {
Class.forName ("oracle.jdbc.OracleDriver");
this.conn = DriverManager.getConnection(conString, conUser, conPass);
}
public void open(String con, String user, String pass) throws Throwable {
Class.forName ("oracle.jdbc.OracleDriver");
if(con != null) this.conString = con;
if(user != null) this.conUser = user;
if(pass != null) this.conPass = pass;
this.conn = DriverManager.getConnection(conString, conUser, conPass);
}
public void close() throws Throwable {
if(conn != null) conn.close();
}
}
package se.lil.om;
import java.util.ArrayList;
public class TestRunner {
public TestRunner() {
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) throws Throwable{
// TODO Auto-generated method stub
ArrayList<OraMon> oraList = new ArrayList<OraMon>();
OraMon mon1 = new OraMon("jdbc:oracle:thin:@//hostname:1521/SID1","system","passw0rd");
OraMon mon2 = new OraMon("jdbc:oracle:thin:@//hostname:1521/SID1","system","passw0rd");
mon1.open();
mon2.open();
oraList.add(mon1);
oraList.add(mon2);
int times = 10;
while(times-- > 0) {
for(OraMon mon : oraList) {
Long ts1 = System.currentTimeMillis();
mon.getData();
Long time = System.currentTimeMillis() - ts1;
System.out.println(
"Logical reads:" + mon.getLogicalReadsPerSecond()
+ " Consistent gets: " + mon.getPerSecondValue("consistent gets")
+ " Block Gets: " + mon.getPerSecondValue("db block gets")
+ " Block Changes: " + mon.getPerSecondValue("db block changes")
+ "\n"
+ "CPUs: " + mon.getNumberOfCPUs()
+ " CPU Time: " + mon.getCPUTimePerSecond() + "ms"
+ " CPU Usage: " + String.format("%1$,.2f", mon.getCPUPercent()) + "%"
+ "\n"
+ "Cache Hit Ratio: " + String.format("%1$,.2f", mon.getCacheHitRatioPercent()) + "%"
+ " Buffer Cache Hit Ratio: " + String.format("%1$,.2f", mon.getBufferCacheHitRatioPercent()) + "%"
+ "\n"
+ "Redo size: " + mon.getPerSecondValue("redo size")
+ " Phys Reads: " + mon.getPerSecondValue("physical reads")
+ " Phys Writes: " + mon.getPerSecondValue("physical writes")
+ " Redo Writes: " + mon.getPerSecondValue("redo writes")
+ "\n"
+ "Non Idle Wait: " + mon.getPerSecondValue("non-idle wait time")
+ " File IO Wait: " + mon.getPerSecondValue("file io wait time")
+ "\n"
+ "Executes: " + mon.getPerSecondValue("execute count")
+ " User calls: " + mon.getPerSecondValue("user calls")
+ " Commits: " + mon.getPerSecondValue("user commits")
+ " Rollbacks: " + mon.getPerSecondValue("user rollbacks")
+ " Parse tot: " + mon.getPerSecondValue("parse count (total)")
+ " Parse hard: " + mon.getPerSecondValue("parse count (hard)")
+ "\nTime: " + time + "ms"
);
}
Thread.sleep(15000);
}
// Close all mon objects
for(OraMon mon : oraList) {
mon.close();
}
}
}