Class Utils
java.lang.Object
org.openjdk.jmh.util.Utils
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterable<T> adaptForLoop(Iterator<T> it) Adapts Iterator for Iterable.static voidstatic voidstatic String[]static intWarm up the CPU schedulers, bring all the CPUs online to get the reasonable estimate of the system capacity.static Stringstatic Stringstatic Stringstatic longstatic longgetPid()Gets PID of the current JVM.static longGets the PID of the target process.static PropertiesWe don't access the complete system properties viaSystem.getProperties()because this would require read/write permissions to the properties.static Charsetprivate static voidindent(PrintWriter pw, int indent) static booleanstatic Stringstatic Stringjoin(Collection<String> src, String delim) static StringmarshalIntArray(int[] arr) static <T extends Comparable<T>>
Tmax(Collection<T> ts) static <T extends Comparable<T>>
Tmin(Collection<T> ts) static Propertiesstatic voidreflow(PrintWriter pw, String src, int width, int indent) static Collection<String> static introundUp(int v, int quant) static Processstatic Collection<String> private static voidsetAccessible(Object holder, AccessibleObject o) static Collection<String> splitQuotedEscape(String src) static intsum(int[] arr) static Stringstatic Collection<String> static int[]unmarshalIntArray(String src)
-
Field Details
-
U
private static final sun.misc.Unsafe U
-
-
Constructor Details
-
Utils
private Utils()
-
-
Method Details
-
min
-
max
-
concat
-
join
-
join
-
splitQuotedEscape
-
sum
public static int sum(int[] arr) -
roundUp
public static int roundUp(int v, int quant) -
throwableToString
-
unmarshalIntArray
-
marshalIntArray
-
figureOutHotCPUs
public static int figureOutHotCPUs()Warm up the CPU schedulers, bring all the CPUs online to get the reasonable estimate of the system capacity. Some systems, notably embedded Linuxes, power down the idle CPUs and so availableProcessors() may report lower CPU count than would be present after the load-up.- Returns:
- max CPU count
-
setAccessible
- Throws:
IllegalAccessException
-
guessConsoleEncoding
-
reflow
-
indent
-
rewrap
-
check
-
check
-
getOffset
-
isWindows
public static boolean isWindows() -
getCurrentJvm
-
getCurrentJvmVersion
-
getCurrentOSVersion
-
getPid
public static long getPid()Gets PID of the current JVM.- Returns:
- PID.
-
getPid
Gets the PID of the target process.- Parameters:
process- to poll- Returns:
- PID, or zero if no PID is found
-
tryWith
-
runAsync
-
runWith
-
getRecordedSystemProperties
We don't access the complete system properties viaSystem.getProperties()because this would require read/write permissions to the properties. Just copy the properties we want to record in the result.- Returns:
- Copy of system properties we want to record in the results.
-
readPropertiesFromCommand
-
adaptForLoop
-