public final class IlrRuntime
extends java.lang.Object
This class is a utility for displaying information about memory and elapsed time used to execute a section of code.
| Modifier and Type | Field and Description |
|---|---|
java.io.PrintStream |
out
This stream is used to print information.
|
static IlrRuntime |
self
This field points to an instance of the class.
|
| Constructor and Description |
|---|
IlrRuntime()
Constructs an
IlrRuntime with no arguments. |
| Modifier and Type | Method and Description |
|---|---|
void |
memorySnapshot()
Performs a runtime memory snapshot.
|
void |
printMemoryUsage(java.lang.String message)
Prints the memory usage at some point of the execution.
|
void |
printTimeUsage(int nrules)
Prints the time usage at some point of the execution using a specified
number of fired rules.
|
void |
printTimeUsage(java.lang.String message)
Prints the time usage at some point of the execution.
|
void |
timeSnapshot()
Requests the current time using
System.currentTimeMillis(), calculates the difference
with the last call of this method, and keeps it for later use. |
public java.io.PrintStream out
This stream is used to print information. It is set initially
to System.out.
public static IlrRuntime self
This field points to an instance of the class. It is created so that the application can use it directly.
public void memorySnapshot()
This method forces the GC to run to:
The difference should represent the memory required by some section
of code. The first invocation of this method allows the object
to initialize its internal data. The second and following calls
will let it compute the difference with the previous one. This
class uses the methods of java.lang.Runtime.
public void timeSnapshot()
Requests the current time using
System.currentTimeMillis(), calculates the difference
with the last call of this method, and keeps it for later use.
The first call initializes internal data, the second and following
calls compute the time difference between the last one.
public void printMemoryUsage(java.lang.String message)
Prints the memory usage at some point of the execution. This method
uses the consumed memory space computed by the last call to
memorySnapshot().
message - A message used to identify what consumed the memory.public void printTimeUsage(java.lang.String message)
Prints the time usage at some point of the execution. This method
uses the consumed time computed by the last call to
timeSnapshot().
message - A message used to identify what consumed the
elapsed time.public void printTimeUsage(int nrules)
Prints the time usage at some point of the execution using a specified
number of fired rules. This method
uses the consumed time computed by the last call to
timeSnapshot() and prints the number of rules fired per
second.
nrules - The number of rules fired in the elapsed time.© Copyright IBM Corp. 1987, 2017