Enum PrintFormat
- java.lang.Object
-
- java.lang.Enum<PrintFormat>
-
- net.obvj.performetrics.util.print.PrintFormat
-
- All Implemented Interfaces:
Serializable,Comparable<PrintFormat>
public enum PrintFormat extends Enum<PrintFormat>
Provides different formatters for printing data from a timing-session container as strings in tabular layout.- Since:
- 2.2.1
- Author:
- oswaldo.bapvic.jr
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DETAILEDGenerates a detailed view of each counter type and timing session available in the timing-session container, one row for each timing session, and the total elapsed time for each type, as well.SUMMARIZEDGenerates a summarized view which represents the total elapsed time for each counter type available in the timing-session container, one row for each type.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckCompatibility(PrintStyle printStyle)Checks if a givenPrintStyleis compatible with thisPrintFormat.abstract Stringformat(TimingSessionContainer container, PrintStyle style)Generates a formatted string containing data from the specified timing-session container, in a custom style.static PrintFormatvalueOf(String name)Returns the enum constant of this type with the specified name.static PrintFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SUMMARIZED
public static final PrintFormat SUMMARIZED
Generates a summarized view which represents the total elapsed time for each counter type available in the timing-session container, one row for each type.Sample output (applying
PrintStyle.SUMMARIZED_TABLE_FULL):==================================== Counter Elapsed time ------------------------------------ Wall clock time 0:00:04.455383500 CPU time 0:00:00.109375000 User time 0:00:00.046875000 System time 0:00:00.062500000 ====================================
Note: Since 2.4.0, some counter types may be excluded from the actual output if specified by the
PrintStyleto be applied.- See Also:
PrintStyle
-
DETAILED
public static final PrintFormat DETAILED
Generates a detailed view of each counter type and timing session available in the timing-session container, one row for each timing session, and the total elapsed time for each type, as well.Sample output (applying
PrintStyle.DETAILED_TABLE_FULL):=============================================== # Elapsed time Elapsed time (+) =============================================== Wall clock time ----------------------------------------------- 0 0:00:01.055824100 0:00:01.055824100 1 0:00:00.836569500 0:00:01.892393600 2 0:00:00.836091100 0:00:02.728484700 3 0:00:00.837092700 0:00:03.565577400 ----------------------------------------------- TOTAL 0:00:03.565577400 =============================================== CPU time ----------------------------------------------- 0 0:00:00.109375000 0:00:00.109375000 1 0:00:00.000000000 0:00:00.109375000 2 0:00:00.000000000 0:00:00.109375000 3 0:00:00.015625000 0:00:00.125000000 ----------------------------------------------- TOTAL 0:00:00.125000000 ===============================================- See Also:
PrintStyle
-
-
Method Detail
-
values
public static PrintFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrintFormat c : PrintFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrintFormat valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
format
public abstract String format(TimingSessionContainer container, PrintStyle style)
Generates a formatted string containing data from the specified timing-session container, in a custom style.- Parameters:
container- the timing-session container to be printedstyle- thePrintStyleto be applied- Returns:
- a string with formatted data from the container
- Throws:
IllegalArgumentException- if the specified PrintStyle is not compatible with this PrintFormat.
-
checkCompatibility
public void checkCompatibility(PrintStyle printStyle)
Checks if a givenPrintStyleis compatible with thisPrintFormat.- Parameters:
printStyle- thePrintStyleto be checked, not null- Throws:
NullPointerException- if the PrintStyle is nullIllegalArgumentException- if the PrintStyle is not compatible- Since:
- 2.2.2
-
-