public abstract class AbstractResultFormatter extends java.lang.Object implements ResultFormatter
ResultFormatter.InfoCategory| Modifier and Type | Field and Description |
|---|---|
private java.lang.StringBuilder |
builder
An internal buffer.
|
private ProcessData |
data
Stores the JVM and process measurements.
|
private java.util.Formatter |
formatter
Stores an instance of the formatter usually used to produce
printf outputs. |
private java.io.PrintStream |
out
Stores the current output stream.
|
private char |
separator
Stores the value columns separator char.
|
private boolean |
showPercentages
Stores if percentages or absolute values should be emitted.
|
private RecorderElement |
total
Stores the recorder element to compare against (usually the program
record).
|
| Constructor and Description |
|---|
AbstractResultFormatter() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears all basic data for reuse of this instance.
|
void |
configure(java.io.PrintStream out,
RecorderElement total,
boolean showPercentages)
Defines the basic data for output.
|
static boolean |
excludeId(java.lang.String id)
Returns if an id should be excluded from printing.
|
protected long |
getIoRead(ProcessData.Measurements measurements)
Returns the total (corrected) bytes read from external input.
|
protected long |
getIoWrite(ProcessData.Measurements measurements)
Returns the total (corrected) bytes written to external output.
|
protected ProcessData.Measurements |
getJvmData()
Returns the JVM data taken from the process data
stored by
setProcessData(ProcessData). |
protected java.io.PrintStream |
getOut()
Returns the currently active output stream.
|
protected ProcessData.Measurements |
getSystemData()
Returns the system data taken from the process data
stored by
setProcessData(ProcessData). |
protected RecorderElement |
getTotal()
Returns the total element to compare against.
|
boolean |
isConfigured()
Returns if this instance was configured by calling
configure(PrintStream, RecorderElement, boolean). |
protected void |
print(double value)
Emits a double value (two decimal places) and a column separator.
|
protected void |
print(float value)
Emits a float value (two decimal places) and a column separator.
|
protected void |
print(int value)
Emits an int value and a column separator.
|
protected void |
print(long value)
Emits a long value and a column separator.
|
protected void |
print(java.lang.String string)
Emits a string and a column separator.
|
protected void |
printf(java.lang.String format,
java.lang.Object... args)
Writes a formatted string to this object's destination using the
specified format string and arguments.
|
protected void |
println()
Emits a new empty line.
|
protected void |
printNanoTime(long nano)
Emits a nano time value (formatted) and a column separator.
|
protected void |
printPercentage(double value)
Emits a percentage value (two decimal places) and a column separator.
|
protected void |
printPercentage(double fraction,
double total)
Prints a percentage or
fraction dependent on
showPercentages. |
protected void |
printPercentage(long fraction,
long total)
Prints a percentage or
fraction dependent on
showPercentages. |
protected void |
printPercentageNanoPrefix(long fraction,
long total)
Prints a percentage or
fraction dependent on
showPercentages with time prefix of interpreting
the values as nano seconds and deriving the time unit. |
protected void |
printSeparator()
Prints the column separator.
|
void |
setProcessData(ProcessData data)
Sets the data on system and JVM process data for printout.
|
protected void |
setSeparator(char separator)
Changes the value column separator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprintCompare, printCurrentStateStatistics, printCurrentStateStatisticsFooter, printHeadline, printIndividual, printInfo, printProcessStatistics, printThreadDataprivate java.lang.StringBuilder builder
private java.util.Formatter formatter
printf outputs. We need an own instance here because
the one in System.out may cause deadlocks. :(private java.io.PrintStream out
private RecorderElement total
private boolean showPercentages
private char separator
private ProcessData data
public static boolean excludeId(java.lang.String id)
id - the id to be testedpublic void clear()
clear in interface ResultFormatterpublic void configure(java.io.PrintStream out,
RecorderElement total,
boolean showPercentages)
setProcessData(ProcessData).configure in interface ResultFormatterout - the target output streamtotal - the recorder element representing the entire programshowPercentages - should percentages be printed or absolute values
insteadpublic boolean isConfigured()
configure(PrintStream, RecorderElement, boolean).isConfigured in interface ResultFormattertrue if it was configured, false elseprotected void printf(java.lang.String format,
java.lang.Object... args)
format - A format string as described in the Java API documentation.args - Arguments referenced by the format specifiers in the format
string.protected void setSeparator(char separator)
separator - the value column separatorprotected java.io.PrintStream getOut()
public void setProcessData(ProcessData data)
setProcessData in interface ResultFormatterdata - the process data objectprotected ProcessData.Measurements getJvmData()
setProcessData(ProcessData).protected ProcessData.Measurements getSystemData()
setProcessData(ProcessData). Please
use getIoRead(de.uni_hildesheim.sse.monitoring.runtime.recordingStrategies.ProcessData.Measurements) instead of
ProcessData.Measurements.getIoRead() and getIoWrite(de.uni_hildesheim.sse.monitoring.runtime.recordingStrategies.ProcessData.Measurements)
instead of ProcessData.Measurements.getIoWrite() as the method in this class
considers the values from total in case that no network
or file statistics are provided.protected long getIoRead(ProcessData.Measurements measurements)
ProcessData.Measurements.getStatus() and corrects
the values if needed based on total. This is needed
because some concrete platforms may not support I/O process accounting.measurements - the measurements objectprotected long getIoWrite(ProcessData.Measurements measurements)
ProcessData.Measurements.getStatus() and corrects
the values if needed based on total. This is needed
because some concrete platforms may not support I/O process accounting.measurements - the measurements objectprotected RecorderElement getTotal()
protected void printSeparator()
protected void printPercentage(double fraction,
double total)
fraction dependent on
showPercentages.fraction - the fraction determining the percentagetotal - the value for 100%protected void printPercentage(long fraction,
long total)
fraction dependent on
showPercentages.fraction - the fraction determining the percentagetotal - the value for 100%protected void printPercentageNanoPrefix(long fraction,
long total)
fraction dependent on
showPercentages with time prefix of interpreting
the values as nano seconds and deriving the time unit.fraction - the fraction determining the percentagetotal - the value for 100%protected void printNanoTime(long nano)
nano - the nano value to be emittedprotected void print(java.lang.String string)
string - the string to be emittedprotected void print(int value)
value - the value to be emittedprotected void print(long value)
value - the value to be emittedprotected void print(double value)
value - the value to be emittedprotected void print(float value)
value - the value to be emittedprotected void printPercentage(double value)
value - the value to be emittedprotected void println()