Package org.openjdk.jmh.util
Class Utils
java.lang.Object
org.openjdk.jmh.util.Utils
-
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 Charsetstatic 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>static Collection<String>static Collection<String>splitQuotedEscape(String src) static intsum(int[] arr) static Stringstatic Collection<String>static int[]unmarshalIntArray(String src)
-
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
-
guessConsoleEncoding
-
reflow
-
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
-
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
Adapts Iterator for Iterable. Can be iterated only once!- Type Parameters:
T- element type- Parameters:
it- iterator- Returns:
- iterable for given iterator
-