Package net.obvj.performetrics
Enum Counter.Type
- java.lang.Object
-
- java.lang.Enum<Counter.Type>
-
- net.obvj.performetrics.Counter.Type
-
- All Implemented Interfaces:
Serializable,Comparable<Counter.Type>
- Enclosing class:
- Counter
public static enum Counter.Type extends Enum<Counter.Type>
Enumerates all supported counter types, defining a particular time fetch strategy for each of them.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CPU_TIMEThe total time spent using a CPU for the current thread.SYSTEM_TIMEThe time spent by the OS kernel to execute system level operations on behalf of the application, such as context switching, resource allocation, etc.USER_TIMEThe total CPU time that the current thread has executed in user mode (i.e., the time spent running current thread's code).WALL_CLOCK_TIMEThe elapsed time experienced by a user waiting for a task to complete.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract longgetTime(TimeUnit timeUnit)Executes a particular time fetching mode that varies for each counter type.StringtoString()Returns the textual representation associated with this type.static Counter.TypevalueOf(String name)Returns the enum constant of this type with the specified name.static Counter.Type[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
WALL_CLOCK_TIME
public static final Counter.Type WALL_CLOCK_TIME
The elapsed time experienced by a user waiting for a task to complete.
-
CPU_TIME
public static final Counter.Type CPU_TIME
The total time spent using a CPU for the current thread.
-
USER_TIME
public static final Counter.Type USER_TIME
The total CPU time that the current thread has executed in user mode (i.e., the time spent running current thread's code).
-
SYSTEM_TIME
public static final Counter.Type SYSTEM_TIME
The time spent by the OS kernel to execute system level operations on behalf of the application, such as context switching, resource allocation, etc.
-
-
Method Detail
-
values
public static Counter.Type[] 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 (Counter.Type c : Counter.Type.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Counter.Type 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
-
toString
public String toString()
Returns the textual representation associated with this type.- Overrides:
toStringin classEnum<Counter.Type>
-
getTime
public abstract long getTime(TimeUnit timeUnit)
Executes a particular time fetching mode that varies for each counter type.- Parameters:
timeUnit- the time unit in which the time will be returned- Returns:
- the amount of time at the current instant, in the specified time unit.
-
-