public class BTraceUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BTraceUtils.Aggregations |
static class |
BTraceUtils.Atomic |
static class |
BTraceUtils.Collections |
static class |
BTraceUtils.Counters |
static class |
BTraceUtils.D |
static class |
BTraceUtils.Export |
static class |
BTraceUtils.Numbers |
static class |
BTraceUtils.Profiling
Profiling support.
|
static class |
BTraceUtils.References |
static class |
BTraceUtils.Reflective |
static class |
BTraceUtils.Speculation |
static class |
BTraceUtils.Strings |
static class |
BTraceUtils.Sys |
static class |
BTraceUtils.Threads
Namespaced methods
|
static class |
BTraceUtils.Time |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
$(int n)
Returns n'th command line argument.
|
static int |
$length()
Returns the number of command line arguments.
|
static int |
accessFlags(java.lang.Class clazz)
Returns the access flags of the given Class.
|
static int |
accessFlags(java.lang.reflect.Field field)
Returns the access flags of the given Field.
|
static int |
addAndGet(java.util.concurrent.atomic.AtomicInteger ai,
int delta)
Atomically adds the given value to the current value.
|
static long |
addAndGet(java.util.concurrent.atomic.AtomicLong al,
long delta)
Atomically adds the given value to the current value.
|
static <V> void |
addLast(java.util.Deque<V> queue,
V value) |
static void |
addToAggregation(Aggregation aggregation,
AggregationKey key,
long value)
Adds a value to the aggregation with a grouping key.
|
static void |
addToAggregation(Aggregation aggregation,
long value)
Adds a value to the aggregation with no grouping key.
|
static long |
availableProcessors()
Returns the number of processors available to the Java virtual machine.
|
static java.lang.String |
bootClassPath()
Returns the boot class path that is used by the bootstrap class loader
to search for class files.
|
static java.lang.Boolean |
box(boolean b)
Returns a Boolean instance representing the specified
boolean value.
|
static java.lang.Byte |
box(byte b)
Returns a Byte instance representing the specified
byte value.
|
static java.lang.Double |
box(double d)
Returns a Double instance representing the specified
double value.
|
static java.lang.Float |
box(float f)
Returns a Float instance representing the specified
float value.
|
static java.lang.Character |
box(char c)
Returns a Character instance representing the specified
char value.
|
static java.lang.Integer |
box(int i)
Returns a Integer instance representing the specified
int value.
|
static java.lang.Long |
box(long l)
Returns a Long instance representing the specified
long value.
|
static java.lang.Short |
box(short s)
Returns a Short instance representing the specified
short value.
|
static java.lang.Class |
classForName(java.lang.String name)
Returns Class object for given class name.
|
static java.lang.Class |
classForName(java.lang.String name,
java.lang.ClassLoader cl)
Returns the Class for the given class name
using the given class loader.
|
static java.lang.Class |
classOf(java.lang.Object obj)
Returns the runtime class of the given Object.
|
static java.lang.String |
classPath()
Returns the Java class path that is used by the system class loader
to search for class files.
|
static <K,V> void |
clear(java.util.Map<K,V> map) |
static void |
clearAggregation(Aggregation aggregation)
Resets values within the aggregation to the default.
|
static void |
commit(int id)
Commits the speculative buffer associated with id.
|
static long |
committed(java.lang.management.MemoryUsage mu)
Returns the amount of memory in bytes that is committed for the Java
virtual machine to use.
|
static boolean |
compare(java.lang.Object obj1,
java.lang.Object obj2)
Indicates whether two given objects are "equal to" one another.
|
static boolean |
compareAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int expect,
int update)
Atomically sets the value of given AtomitInteger to the given
updated value if the current value
== the expected value. |
static boolean |
compareAndSet(java.util.concurrent.atomic.AtomicLong al,
long expect,
long update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
static int |
compareTo(java.lang.String str1,
java.lang.String str2)
Compares two strings lexicographically.
|
static int |
compareToIgnoreCase(java.lang.String str1,
java.lang.String str2)
Compares two strings lexicographically, ignoring case
differences.
|
static java.lang.String |
concat(java.lang.String str1,
java.lang.String str2)
Concatenates the specified strings together.
|
static <E> boolean |
contains(java.util.Collection<E> coll,
java.lang.Object obj) |
static boolean |
contains(java.lang.Object[] array,
java.lang.Object value) |
static <K,V> boolean |
containsKey(java.util.Map<K,V> map,
java.lang.Object key) |
static <K,V> boolean |
containsValue(java.util.Map<K,V> map,
java.lang.Object value) |
static java.lang.ClassLoader |
contextClassLoader()
Returns the current context class loader
|
static java.lang.Thread |
currentThread()
Returns a reference to the currently executing thread object.
|
static long |
currentThreadCpuTime()
Returns the total CPU time for the current thread in nanoseconds.
|
static long |
currentThreadUserTime()
Returns the CPU time that the current thread has executed
in user mode in nanoseconds.
|
static long |
daemonThreadCount()
Returns the current number of live daemon threads.
|
static void |
deadlocks()
Prints the Java level deadlocks detected (if any).
|
static void |
deadlocks(boolean stackTrace)
Prints deadlocks detected (if any).
|
static java.lang.Class |
declaringClass(java.lang.reflect.Field field)
Returns the Class object representing the class or interface
that declares the field represented by the given Field object.
|
static int |
decrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.
|
static long |
decrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.
|
static java.lang.Object |
deref(java.lang.ref.Reference ref)
Returns the given reference object's referent.
|
static void |
discard(int id)
Discards the speculative buffer associated with id.
|
static int |
dtraceProbe(java.lang.String str1,
java.lang.String str2)
BTrace to DTrace communication chennal.
|
static int |
dtraceProbe(java.lang.String str1,
java.lang.String str2,
int i1)
BTrace to DTrace communication chennal.
|
static int |
dtraceProbe(java.lang.String str1,
java.lang.String str2,
int i1,
int i2)
BTrace to DTrace communication channel.
|
static void |
dumpHeap(java.lang.String fileName)
Dump the snapshot of the Java heap to a file in hprof
binary format.
|
static void |
dumpHeap(java.lang.String fileName,
boolean live)
Dump the snapshot of the Java heap to a file in hprof
binary format.
|
static boolean |
endsWith(java.lang.String s,
java.lang.String end) |
static void |
exit()
This is same as exit(int) except that the exit code
is zero.
|
static void |
exit(int exitCode)
Exits the BTrace session -- note that the particular client's tracing
session exits and not the observed/traced program!
|
static double |
exp(double a)
Returns Euler's number e raised to the power of a
double value. |
static java.lang.reflect.Field |
field(java.lang.Class clazz,
java.lang.String name)
Returns a
Field object that reflects the specified declared
field of the class or interface represented by the given Class
object. |
static java.lang.reflect.Field |
field(java.lang.Class clazz,
java.lang.String name,
boolean throwException)
Returns a
Field object that reflects the specified declared
field of the class or interface represented by the given Class
object. |
static java.lang.reflect.Field |
field(java.lang.String clazz,
java.lang.String name)
Returns a
Field object that reflects the specified declared
field of the class or interface represented by the given Class
object. |
static java.lang.reflect.Field |
field(java.lang.String clazz,
java.lang.String name,
boolean throwException)
Returns a
Field object that reflects the specified declared
field of the class or interface represented by the given Class
object. |
static long |
finalizationCount()
Returns the approximate number of objects for
which finalization is pending.
|
static long |
freeMemory()
Returns the amount of free memory in the Java Virtual Machine.
|
static void |
gc()
Runs the garbage collector.
|
static int |
get(java.util.concurrent.atomic.AtomicInteger ai)
Gets the current value of the given AtomicInteger.
|
static long |
get(java.util.concurrent.atomic.AtomicLong al)
Gets the current value the given AtomicLong.
|
static java.lang.Object |
get(java.lang.reflect.Field field)
Gets the value of a static reference field.
|
static java.lang.Object |
get(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance reference field.
|
static <K,V> V |
get(java.util.Map<K,V> map,
java.lang.Object key) |
static int |
getAndAdd(java.util.concurrent.atomic.AtomicInteger ai,
int delta)
Atomically adds the given value to the current value.
|
static long |
getAndAdd(java.util.concurrent.atomic.AtomicLong al,
long delta)
Atomically adds the given value to the current value.
|
static int |
getAndDecrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.
|
static long |
getAndDecrement(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.
|
static int |
getAndIncrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.
|
static long |
getAndIncrement(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.
|
static int |
getAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Atomically sets to the given value and returns the old value.
|
static long |
getAndSet(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Atomically sets to the given value and returns the old value.
|
static boolean |
getBoolean(java.lang.reflect.Field field)
Gets the value of a static
boolean field. |
static boolean |
getBoolean(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
boolean field. |
static byte |
getByte(java.lang.reflect.Field field)
Gets the value of a static
byte field. |
static byte |
getByte(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
byte field. |
static java.lang.Class |
getComponentType(java.lang.Class clazz)
returns component type of an array Class.
|
static double |
getDouble(java.lang.reflect.Field field)
Gets the value of a static
double field. |
static double |
getDouble(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
double field. |
static java.util.Map<java.lang.String,java.lang.String> |
getenv()
Returns an unmodifiable string map view of the current system environment.
|
static java.lang.String |
getenv(java.lang.String name)
Gets the value of the specified environment variable.
|
static float |
getFloat(java.lang.reflect.Field field)
Gets the value of a static
float field. |
static float |
getFloat(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
float field. |
static char |
getChar(java.lang.reflect.Field field)
Gets the value of a static
char field. |
static char |
getChar(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
char field. |
static int |
getInt(java.lang.reflect.Field field)
Gets the value of a static
int field. |
static int |
getInt(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
int field. |
static long |
getLong(java.lang.reflect.Field field)
Gets the value of a static
long field. |
static long |
getLong(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
long field. |
static int |
getpid()
Returns the process id of the currently BTrace'd process.
|
static short |
getShort(java.lang.reflect.Field field)
Gets the value of a static
short field. |
static short |
getShort(java.lang.reflect.Field field,
java.lang.Object obj)
Gets the value of an instance
short field. |
static java.lang.Class |
getSuperclass(java.lang.Class clazz)
Returns the
Class representing the superclass of the entity
(class, interface, primitive type or void) represented by the given
Class . |
static long |
getTotalGcTime()
Returns the total amount of time spent in GarbageCollection up to this point
since the application was started.
|
static int |
hash(java.lang.Object obj)
Returns a hash code value for the object.
|
static java.lang.management.MemoryUsage |
heapUsage()
Returns heap memory usage
|
static boolean |
holdsLock(java.lang.Object obj)
Returns true if and only if the current thread holds the
monitor lock on the specified object.
|
static int |
identityHashCode(java.lang.Object obj)
Returns the same hash code for the given object as
would be returned by the default method hashCode(),
whether or not the given object's class overrides
hashCode().
|
static java.lang.String |
identityStr(java.lang.Object obj)
Returns identity string of the form class-name@identity-hash
|
static int |
incrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.
|
static long |
incrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.
|
static int |
indexOf(java.lang.String str1,
java.lang.String str2) |
static long |
init(java.lang.management.MemoryUsage mu)
Returns the amount of memory in bytes that the Java virtual
machine initially requests from the operating system for
memory management.
|
static boolean |
isArray(java.lang.Class clazz)
Determines if the given
Class object represents an array class. |
static boolean |
isAssignableFrom(java.lang.Class<?> a,
java.lang.Class<?> b)
Determines if the class or interface represented by the first
Class object is either the same as, or is a superclass or
superinterface of, the class or interface represented by the second
Class parameter. |
static boolean |
isBootClassPathSupported()
Tests if the Java virtual machine supports the boot class path
mechanism used by the bootstrap class loader to search for class
files.
|
static <E> boolean |
isEmpty(java.util.Collection<E> coll) |
static <K,V> boolean |
isEmpty(java.util.Map<K,V> map) |
static boolean |
isInfinite(double d)
Returns
true if the specified number is infinitely
large in magnitude, false otherwise. |
static boolean |
isInfinite(float f)
Returns
true if the specified number is infinitely
large in magnitude, false otherwise. |
static boolean |
isInstance(java.lang.Class clazz,
java.lang.Object obj)
Determines if the specified
Object is assignment-compatible
with the object represented by the specified Class . |
static boolean |
isInterface(java.lang.Class clazz)
Determines if the specified
Class object represents an
interface type. |
static boolean |
isInteruppted()
Tests whether this thread has been interrupted.
|
static boolean |
isNaN(double d)
Returns
true if the specified number is a
Not-a-Number (NaN) value, false otherwise. |
static boolean |
isNaN(float f)
Returns
true if the specified number is a
Not-a-Number (NaN) value, false otherwise. |
static boolean |
isPrimitive(java.lang.Class clazz)
Returns whether the given Class represent primitive type or not.
|
static void |
jstack()
Prints the java stack trace of the current thread.
|
static void |
jstack(int numFrames)
Prints the java stack trace of the current thread.
|
static void |
jstack(java.lang.Throwable exception)
Prints the stack trace of the given exception object.
|
static void |
jstack(java.lang.Throwable exception,
int numFrames)
Prints the stack trace of the given exception object.
|
static void |
jstackAll()
Prints Java stack traces of all the Java threads.
|
static void |
jstackAll(int numFrames)
Prints Java stack traces of all the Java threads.
|
static java.lang.String |
jstackAllStr()
Returns the stack traces of all Java threads as a String.
|
static java.lang.String |
jstackAllStr(int numFrames)
Returns atmost given number of frames in stack traces
of all threads as a String.
|
static java.lang.String |
jstackStr()
Returns the stack trace of current thread as a String.
|
static java.lang.String |
jstackStr(int numFrames)
Returns the stack trace of the current thread as a String
but includes atmost the given number of frames.
|
static java.lang.String |
jstackStr(java.lang.Throwable exception)
Returns the stack trace of given exception object as a String.
|
static java.lang.String |
jstackStr(java.lang.Throwable exception,
int numFrames)
Returns stack trace of given exception object as a String.
|
static int |
lastIndexOf(java.lang.String str1,
java.lang.String str2) |
static void |
lazySet(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Eventually sets to the given value to the given AtomicInteger.
|
static void |
lazySet(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Eventually sets to the given value to the given AtomicLong.
|
static int |
length(java.lang.String str)
Returns the length of the given string.
|
static java.lang.String |
libraryPath()
Returns the Java library path.
|
static java.lang.ClassLoader |
loader(java.lang.Class clazz)
Returns the class loader for the given class.
|
static double |
log(double a)
Returns the natural logarithm (base e) of a
double
value. |
static double |
log10(double a)
Returns the base 10 logarithm of a
double value. |
static boolean |
matches(java.util.regex.Pattern regex,
java.lang.String input)
Matches the given (precompiled) regular expression and attempts
to match the given input against it.
|
static boolean |
matches(java.lang.String regex,
java.lang.String input)
Compiles the given regular expression and attempts to match the given
input against it.
|
static long |
max(java.lang.management.MemoryUsage mu)
Returns the maximum amount of memory in bytes that can be used
for memory management.
|
static long |
maxMemory()
Returns the maximum amount of memory that the Java virtual machine will
attempt to use.
|
static java.lang.String |
name(java.lang.Class clazz)
Returns the name of the given Class object.
|
static java.lang.String |
name(java.lang.reflect.Field field)
Returns the name of the Field object.
|
static java.lang.String |
name(java.lang.Thread thread)
Returns the name of the given thread.
|
static Aggregation |
newAggregation(AggregationFunction type)
Creates a new aggregation based on the given aggregation function type.
|
static AggregationKey |
newAggregationKey(java.lang.Object element1)
Creates a grouping aggregation key with the provided value.
|
static AggregationKey |
newAggregationKey(java.lang.Object element1,
java.lang.Object element2)
Creates a composite grouping aggregation key with the provided values.
|
static AggregationKey |
newAggregationKey(java.lang.Object element1,
java.lang.Object element2,
java.lang.Object element3)
Creates a composite grouping aggregation key with the provided values.
|
static AggregationKey |
newAggregationKey(java.lang.Object element1,
java.lang.Object element2,
java.lang.Object element3,
java.lang.Object element4)
Creates a composite grouping aggregation key with the provided values.
|
static java.util.concurrent.atomic.AtomicInteger |
newAtomicInteger(int initialValue)
Creates a new AtomicInteger with the given initial value.
|
static java.util.concurrent.atomic.AtomicLong |
newAtomicLong(long initialValue)
Creates a new AtomicLong with the given initial value.
|
static <V> java.util.Deque<V> |
newDeque() |
static <K,V> java.util.Map<K,V> |
newHashMap()
Operating on maps
|
static <K,V> java.util.Map<K,V> |
newWeakMap() |
static java.lang.management.MemoryUsage |
nonHeapUsage()
Returns non-heap memory usage
|
static java.lang.ClassLoader |
parentLoader(java.lang.ClassLoader loader)
Returns the parent class loader of the given loader.
|
static boolean |
parseBoolean(java.lang.String s)
Parses the string argument as a boolean.
|
static byte |
parseByte(java.lang.String s)
Parses the string argument as a signed decimal
byte . |
static double |
parseDouble(java.lang.String s)
Returns a new
double initialized to the value
represented by the specified String , as performed
by the valueOf methcod of class
Double . |
static float |
parseFloat(java.lang.String s)
Returns a new
float initialized to the value
represented by the specified String , as performed
by the valueOf method of class Float . |
static int |
parseInt(java.lang.String s)
Parses the string argument as a signed decimal integer.
|
static long |
parseLong(java.lang.String s)
Parses the string argument as a signed decimal
long . |
static short |
parseShort(java.lang.String s)
Parses the string argument as a signed decimal
short . |
static java.util.regex.Pattern |
pattern(java.lang.String regex)
This is synonym for "regexp".
|
static java.util.regex.Pattern |
pattern(java.lang.String regex,
int flags)
This is synonym for "regexp".
|
static long |
peakThreadCount()
Returns the peak live thread count since the Java virtual machine
started or peak was reset.
|
static <V> V |
peek(java.util.Deque<V> queue) |
static <V> V |
peekFirst(java.util.Deque<V> queue) |
static <V> V |
peekLast(java.util.Deque<V> queue) |
static long |
perfInt(java.lang.String name)
accessing jvmstat (perf) int counter
|
static long |
perfLong(java.lang.String name)
accessing jvmstat (perf) long counter
|
static java.lang.String |
perfString(java.lang.String name)
accessing jvmstat (perf) String counter
|
static <V> V |
poll(java.util.Deque<V> queue) |
static void |
print(boolean b)
Prints a boolean value.
|
static void |
print(double d)
Prints a double-precision floating-point number.
|
static void |
print(float f)
Prints a floating-point number.
|
static void |
print(char c)
Prints a character.
|
static void |
print(int i)
Prints an integer.
|
static void |
print(long l)
Prints a long integer.
|
static void |
print(java.lang.Object obj) |
static void |
printAggregation(java.lang.String name,
Aggregation aggregation)
Prints the aggregation.
|
static void |
printAggregation(java.lang.String name,
Aggregation aggregation,
java.lang.String format)
Prints aggregation using the provided format
|
static void |
printArray(java.lang.Object[] array)
Prints the elements of the given array as comma
separated line bounded by '[' and ']'.
|
static void |
printEnv()
Prints all system environment values.
|
static void |
printFields(java.lang.Object obj)
Print all instance fields of an object as name-value
pairs.
|
static void |
printFields(java.lang.Object obj,
boolean classNamePrefix)
Print all instance fields of an object as name-value
pairs.
|
static void |
println()
Terminates the current line by writing the line separator string.
|
static void |
println(boolean b)
Prints a boolean and then terminate the line.
|
static void |
println(double d)
Prints a double and then terminate the line.
|
static void |
println(float f)
Prints a float and then terminate the line.
|
static void |
println(char c)
Prints a character and then terminate the line.
|
static void |
println(int i)
Prints an integer and then terminate the line.
|
static void |
println(long l)
Prints a long and then terminate the line.
|
static void |
println(java.lang.Object obj)
Prints the given object and then prints a newline
|
static void |
printMap(java.util.Map map)
Prints the given Map.
|
static void |
printNumber(java.lang.String name,
java.lang.Number value)
Prints a number.
|
static void |
printNumberMap(java.lang.String name,
java.util.Map<java.lang.String,? extends java.lang.Number> data)
Prints the given Map.
|
static void |
printProperties()
Prints all Sys properties.
|
static void |
printStaticFields(java.lang.Class clazz)
Print all static fields of the class as name-value
pairs.
|
static void |
printStaticFields(java.lang.Class clazz,
boolean classNamePrefix)
Print all static fields of the class as name-value
pairs.
|
static void |
printStringMap(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> data)
Prints the given Map.
|
static void |
printVmArguments()
Prints VM input arguments list.
|
static java.lang.Class |
probeClass()
Deprecated.
Since 1.1. Use ProbeClassName and Self annotations instead
|
static int |
probeLine()
Returns the currently probed source line number (if available).
|
static java.lang.String |
probeMethod()
Deprecated.
Since 1.1. Use ProbeMethodName annotation instead
|
static java.util.Properties |
properties()
Returns all Sys properties.
|
static java.lang.String |
property(java.lang.String key)
Gets the system property indicated by the specified key.
|
static <V> void |
push(java.util.Deque<V> queue,
V value) |
static <K,V> V |
put(java.util.Map<K,V> map,
K key,
V value) |
static double |
random()
Returns a
double value with a positive sign, greater
than or equal to 0.0 and less than 1.0 . |
static java.util.regex.Pattern |
regexp(java.lang.String regex)
Compiles the given regular expression into a pattern.
|
static java.util.regex.Pattern |
regexp(java.lang.String regex,
int flags)
Compiles the given regular expression into a pattern with the given
flags.
|
static <K,V> V |
remove(java.util.Map<K,V> map,
java.lang.Object key) |
static <V> V |
removeFirst(java.util.Deque<V> queue) |
static <V> V |
removeLast(java.util.Deque<V> queue) |
static void |
runFinalization()
Runs the finalization methods of any objects pending finalization.
|
static void |
serialize(java.io.Serializable obj,
java.lang.String fileName)
Serialize a given object into the given file.
|
static void |
set(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Sets to the given value to the given AtomicInteger.
|
static void |
set(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Sets to the given value.
|
static <E> int |
size(java.util.Collection<E> coll) |
static <K,V> int |
size(java.util.Map<K,V> map) |
static long |
sizeof(java.lang.Object objectToSize)
Returns an implementation-specific approximation of the amount of storage consumed by
the specified object.
|
static java.lang.ref.SoftReference |
softRef(java.lang.Object obj)
Creates and returns a soft reference to the given object.
|
static void |
speculate(int id)
Sets current speculative buffer id.
|
static int |
speculation()
Returns an identifier for a new speculative buffer.
|
static boolean |
startsWith(java.lang.String s,
java.lang.String start) |
static java.lang.String |
str(boolean b)
Returns a String object representing the specified
boolean.
|
static java.lang.String |
str(double d)
Returns a string representation of the
double
argument. |
static java.lang.String |
str(float f)
Returns a string representation of the
float
argument. |
static java.lang.String |
str(char c)
Returns a
String object representing the
specified char . |
static java.lang.String |
str(int i)
Returns a
String object representing the
specified integer. |
static java.lang.String |
str(long l)
Returns a
String object representing the specified
long . |
static java.lang.String |
str(java.lang.Object obj)
Returns a string representation of the object.
|
static java.lang.String |
strcat(java.lang.String str1,
java.lang.String str2)
This is synonym to "concat".
|
static int |
strcmp(java.lang.String str1,
java.lang.String str2)
This is synonym to "compareTo" method.
|
static int |
stricmp(java.lang.String str1,
java.lang.String str2)
This is synonym to "compareToIgnoreCase".
|
static int |
strlen(java.lang.String str)
This is synonym for "length".
|
static int |
strstr(java.lang.String str1,
java.lang.String str2)
Find String within String
|
static java.lang.String |
substr(java.lang.String str,
int start) |
static java.lang.String |
substr(java.lang.String str,
int start,
int length)
Substring
|
static long |
threadCount()
Returns the current number of live threads including both
daemon and non-daemon threads.
|
static long |
threadId(java.lang.Thread thread)
Returns the identifier of the given Thread.
|
static java.lang.Thread.State |
threadState(java.lang.Thread thread)
Returns the state of the given thread.
|
static long |
timeMillis()
Returns the current time in milliseconds.
|
static long |
timeNanos()
Returns the current value of the most precise available system
timer, in nanoseconds.
|
static java.lang.String |
timestamp()
Generates a string getTimestamp (current date&time) in the default system format
|
static java.lang.String |
timestamp(java.lang.String format)
Generates a string getTimestamp (current date&time)
|
static java.lang.String |
toHexString(int i)
Returns a string representation of the integer argument as an
unsigned integer in base 16.
|
static java.lang.String |
toHexString(long l)
Returns a string representation of the
long
argument as an unsigned integer in base 16. |
static long |
totalMemory()
Returns the total amount of memory in the Java virtual machine.
|
static long |
totalStartedThreadCount()
Returns the total number of threads created and also started
since the Java virtual machine started.
|
static java.lang.String |
toXML(java.lang.Object obj)
Creates an XML document to persist the tree of the all
transitively reachable objects from given "root" object.
|
static void |
truncateAggregation(Aggregation aggregation,
int count)
Removes all aggregated values from the aggregation except for the largest or smallest
abs(count) elements. |
static java.lang.Class |
type(java.lang.reflect.Field field)
Returns the type of the Field object.
|
static boolean |
unbox(java.lang.Boolean b)
Returns the value of the given Boolean object as a boolean
primitive.
|
static byte |
unbox(java.lang.Byte b)
Returns the value of the specified Byte as a
byte . |
static double |
unbox(java.lang.Double d)
Returns the double value represented by the specified
Double . |
static float |
unbox(java.lang.Float f)
Returns the float value represented by the specified
Float . |
static char |
unbox(java.lang.Character ch)
Returns the value of the given Character object as a char
primitive.
|
static int |
unbox(java.lang.Integer i)
Returns the value of represented by
Integer . |
static long |
unbox(java.lang.Long l)
Returns the long value represented by the specified
Long . |
static short |
unbox(java.lang.Short s)
Returns the short value represented by
Short . |
static long |
used(java.lang.management.MemoryUsage mu)
Returns the amount of used memory in bytes.
|
static java.util.List<java.lang.String> |
vmArguments()
Returns the input arguments passed to the Java virtual machine
which does not include the arguments to the main method.
|
static long |
vmStartTime()
Returns the start time of the Java virtual machine in milliseconds.
|
static long |
vmUptime()
Returns the uptime of the Java virtual machine in milliseconds.
|
static java.lang.String |
vmVersion()
Returns the Java virtual machine implementation version.
|
static boolean |
weakCompareAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int expect,
int update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
static boolean |
weakCompareAndSet(java.util.concurrent.atomic.AtomicLong al,
long expect,
long update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
static java.lang.ref.WeakReference |
weakRef(java.lang.Object obj)
Creates and returns a weak reference to the given object.
|
static void |
writeDOT(java.lang.Object obj,
java.lang.String fileName)
Writes a .dot document to persist the tree of the all the
transitively reachable objects from the given "root" object.
.dot documents can be viewed by Graphviz application (www.graphviz.org)
Under the current dir of traced app, .
|
static void |
writeXML(java.lang.Object obj,
java.lang.String fileName)
Writes an XML document to persist the tree of the all the
transitively reachable objects from the given "root" object.
|
public static boolean isInteruppted()
A thread interruption ignored because a thread was not alive at the time of the interrupt will be reflected by this method returning false.
true
if this thread has been interrupted;
false
otherwise.public static void jstack()
public static void jstack(int numFrames)
numFrames
- number of frames to be printed. When this is
negative all frames are printed.public static void jstackAll()
public static void jstackAll(int numFrames)
numFrames
- number of frames to be printed. When this is
negative all frames are printed.public static java.lang.String jstackStr()
public static java.lang.String jstackStr(int numFrames)
numFrames
- number of frames to be included. When this is
negative all frames are included.public static java.lang.String jstackAllStr()
public static java.lang.String jstackAllStr(int numFrames)
numFrames
- number of frames to be included. When this is
negative all frames are included.public static void jstack(java.lang.Throwable exception)
exception
- throwable for which stack trace is printed.public static void jstack(java.lang.Throwable exception, int numFrames)
exception
- throwable for which stack trace is printed.numFrames
- maximum number of frames to be printed.public static java.lang.String jstackStr(java.lang.Throwable exception)
exception
- the throwable for which stack trace is returned.public static java.lang.String jstackStr(java.lang.Throwable exception, int numFrames)
exception
- throwable for which stack trace is returned.numFrames
- maximum number of frames to be returned.public static java.lang.Thread currentThread()
public static long threadId(java.lang.Thread thread)
public static java.lang.Thread.State threadState(java.lang.Thread thread)
public static boolean holdsLock(java.lang.Object obj)
This method is designed to allow a program to assert that the current thread already holds a specified lock:
assert Thread.holdsLock(obj);
obj
- the object on which to test lock ownershipjava.lang.NullPointerException
- if obj is nullpublic static void deadlocks()
public static void deadlocks(boolean stackTrace)
stackTrace
- boolean flag to specify whether to
print stack traces of deadlocked threads or not.public static java.lang.String name(java.lang.Thread thread)
thread
- thread whose name is returnedpublic static java.lang.ClassLoader loader(java.lang.Class clazz)
clazz
- the Class for which the class loader is returnedpublic static java.lang.ClassLoader parentLoader(java.lang.ClassLoader loader)
loader
- the loader for which the parent loader is returnedpublic static java.lang.String str(java.lang.Object obj)
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read. For bootstrap classes, returns the result of
calling Object.toString() override. For non-bootstrap classes,
default toString() value [className@hashCode] is returned.obj
- the object whose string representation is returnedpublic static java.lang.String identityStr(java.lang.Object obj)
obj
- object for which identity string is returnedpublic static int hash(java.lang.Object obj)
java.util.Hashtable
. For bootstrap classes, returns the
result of calling Object.hashCode() override. For non-bootstrap classes,
the identity hash code is returned.obj
- the Object whose hash code is returned.public static int identityHashCode(java.lang.Object obj)
obj
- object for which the hashCode is to be calculatedpublic static boolean compare(java.lang.Object obj1, java.lang.Object obj2)
obj1
- first object to compare equalityobj2
- second object to compare equalitytrue
if the given objects are equal;
false
otherwise.public static java.lang.Class classOf(java.lang.Object obj)
obj
- the Object whose Class is returnedpublic static java.lang.Class declaringClass(java.lang.reflect.Field field)
field
- whose declaring Class is returnedpublic static java.lang.String name(java.lang.Class clazz)
public static java.lang.String name(java.lang.reflect.Field field)
field
- Field for which name is returnedpublic static java.lang.Class type(java.lang.reflect.Field field)
field
- Field for which type is returnedpublic static int accessFlags(java.lang.Class clazz)
public static int accessFlags(java.lang.reflect.Field field)
public static java.lang.ClassLoader contextClassLoader()
public static java.lang.Class classForName(java.lang.String name)
public static java.lang.Class classForName(java.lang.String name, java.lang.ClassLoader cl)
public static boolean isAssignableFrom(java.lang.Class<?> a, java.lang.Class<?> b)
Class
object is either the same as, or is a superclass or
superinterface of, the class or interface represented by the second
Class
parameter. It returns true
if so;
otherwise it returns false
.public static boolean isInstance(java.lang.Class clazz, java.lang.Object obj)
Object
is assignment-compatible
with the object represented by the specified Class
. This method is
the dynamic equivalent of the Java language instanceof
operator. The method returns true
if the specified
Object
argument is non-null and can be cast to the
reference type represented by this Class
object without
raising a ClassCastException.
It returns false
otherwise.clazz
- the class that is checked.obj
- the object to check.obj
is an instance of the given class.public static java.lang.Class getSuperclass(java.lang.Class clazz)
Class
representing the superclass of the entity
(class, interface, primitive type or void) represented by the given
Class
. If the given Class
represents either the
Object
class, an interface, a primitive type, or void, then
null is returned. If the given object represents an array class then the
Class
object representing the Object
class is
returned.clazz
- the Class whose super class is returned.public static boolean isInterface(java.lang.Class clazz)
Class
object represents an
interface type.clazz
- the Class object to check.true
if the Class represents an interface;
false
otherwise.public static boolean isArray(java.lang.Class clazz)
Class
object represents an array class.clazz
- Class object to check.true
if the given object represents an array class;
false
otherwise.public static boolean isPrimitive(java.lang.Class clazz)
public static java.lang.Class getComponentType(java.lang.Class clazz)
public static java.lang.reflect.Field field(java.lang.Class clazz, java.lang.String name, boolean throwException)
Field
object that reflects the specified declared
field of the class or interface represented by the given Class
object. The name
parameter is a String
that
specifies the simple name of the desired field. Returns null
on not finding
field if throwException parameter is false
. Else throws a RuntimeException
when field is not found.clazz
- Class whose field is returnedname
- the name of the fieldthrowException
- whether to throw exception on failing to find field or notField
object for the specified field in this
classpublic static java.lang.reflect.Field field(java.lang.Class clazz, java.lang.String name)
Field
object that reflects the specified declared
field of the class or interface represented by the given Class
object. The name
parameter is a String
that
specifies the simple name of the desired field. Throws a RuntimeException
when field is not found.clazz
- Class whose field is returnedname
- the name of the fieldField
object for the specified field in this
classpublic static java.lang.reflect.Field field(java.lang.String clazz, java.lang.String name, boolean throwException)
Field
object that reflects the specified declared
field of the class or interface represented by the given Class
object. The name
parameter is a String
that
specifies the simple name of the desired field. Returns null
on not finding
field if throwException parameter is false
. Else throws a RuntimeException
when field is not found.clazz
- Class whose field is returnedname
- the name of the fieldthrowException
- whether to throw exception on failing to find field or notField
object for the specified field in this
classpublic static java.lang.reflect.Field field(java.lang.String clazz, java.lang.String name)
Field
object that reflects the specified declared
field of the class or interface represented by the given Class
object. The name
parameter is a String
that
specifies the simple name of the desired field. Throws a RuntimeException
when field is not found.clazz
- Class whose field is returnedname
- the name of the fieldField
object for the specified field in this
classpublic static byte getByte(java.lang.reflect.Field field)
byte
field.field
- Field object whose value is returned.byte
fieldpublic static byte getByte(java.lang.reflect.Field field, java.lang.Object obj)
byte
field.field
- Field object whose value is returned.obj
- the object to extract the byte
value
frombyte
fieldpublic static short getShort(java.lang.reflect.Field field)
short
field.field
- Field object whose value is returned.short
fieldpublic static short getShort(java.lang.reflect.Field field, java.lang.Object obj)
short
field.field
- Field object whose value is returned.obj
- the object to extract the short
value
fromshort
fieldpublic static int getInt(java.lang.reflect.Field field)
int
field.field
- Field object whose value is returned.int
fieldpublic static int getInt(java.lang.reflect.Field field, java.lang.Object obj)
int
field.field
- Field object whose value is returned.obj
- the object to extract the int
value
fromint
fieldpublic static long getLong(java.lang.reflect.Field field)
long
field.field
- Field object whose value is returned.long
fieldpublic static long getLong(java.lang.reflect.Field field, java.lang.Object obj)
long
field.field
- Field object whose value is returned.obj
- the object to extract the long
value
fromlong
fieldpublic static float getFloat(java.lang.reflect.Field field)
float
field.field
- Field object whose value is returned.float
fieldpublic static float getFloat(java.lang.reflect.Field field, java.lang.Object obj)
float
field.field
- Field object whose value is returned.obj
- the object to extract the float
value
fromfloat
fieldpublic static double getDouble(java.lang.reflect.Field field)
double
field.field
- Field object whose value is returned.double
fieldpublic static double getDouble(java.lang.reflect.Field field, java.lang.Object obj)
double
field.field
- Field object whose value is returned.obj
- the object to extract the double
value
fromdouble
fieldpublic static boolean getBoolean(java.lang.reflect.Field field)
boolean
field.field
- Field object whose value is returned.boolean
fieldpublic static boolean getBoolean(java.lang.reflect.Field field, java.lang.Object obj)
boolean
field.field
- Field object whose value is returned.obj
- the object to extract the boolean
value
fromboolean
fieldpublic static char getChar(java.lang.reflect.Field field)
char
field.field
- Field object whose value is returned.char
fieldpublic static char getChar(java.lang.reflect.Field field, java.lang.Object obj)
char
field.field
- Field object whose value is returned.obj
- the object to extract the char
value
fromchar
fieldpublic static java.lang.Object get(java.lang.reflect.Field field)
field
- Field object whose value is returned.public static java.lang.Object get(java.lang.reflect.Field field, java.lang.Object obj)
field
- Field object whose value is returned.obj
- the object to extract the reference value
frompublic static java.lang.ref.WeakReference weakRef(java.lang.Object obj)
obj
- object for which a weak reference is created.public static java.lang.ref.SoftReference softRef(java.lang.Object obj)
obj
- object for which a soft reference is created.public static java.lang.Object deref(java.lang.ref.Reference ref)
null
.ref
- reference object whose referent is returned.null
if the reference object has been cleared.public static java.lang.Class probeClass()
@Deprecated public static java.lang.String probeMethod()
public static int probeLine()
public static void printMap(java.util.Map map)
map
- Map that is printed.public static void printStringMap(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> data)
name
- - the name of the mapdata
- - the map datapublic static void printNumberMap(java.lang.String name, java.util.Map<java.lang.String,? extends java.lang.Number> data)
name
- - the name of the mapdata
- - the map datapublic static void printNumber(java.lang.String name, java.lang.Number value)
name
- - name of the number datavalue
- - value of the numerical datapublic static void printArray(java.lang.Object[] array)
public static void printFields(java.lang.Object obj)
obj
- Object whose fields are printed.public static void printFields(java.lang.Object obj, boolean classNamePrefix)
obj
- Object whose fields are printed.classNamePrefix
- flag to tell whether to prefix field names
names by class name or not.public static void printStaticFields(java.lang.Class clazz)
clazz
- Class whose static fields are printed.public static void printStaticFields(java.lang.Class clazz, boolean classNamePrefix)
clazz
- Class whose static fields are printed.classNamePrefix
- flag to tell whether to prefix field names
names by class name or not.public static void print(java.lang.Object obj)
public static void print(boolean b)
String.valueOf(boolean)
is sent to BTrace client
for "printing".b
- The boolean
to be printedpublic static void print(char c)
Character.valueOf(char)
is sent to BTrace client
for "printing".c
- The char
to be printedpublic static void print(int i)
String.valueOf(int)
is sent to BTrace client for "printing".i
- The int
to be printedInteger.toString(int)
public static void print(long l)
String.valueOf(long)
is sent to BTrace client for "printing".l
- The long
to be printedLong.toString(long)
public static void print(float f)
String.valueOf(float)
is sent to BTrace client for "printing".f
- The float
to be printedFloat.toString(float)
public static void print(double d)
String.valueOf(double)
is sent to BTrace client
for "printing".d
- The double
to be printedDouble.toString(double)
public static void println(java.lang.Object obj)
public static void println(boolean b)
print(boolean)
and then
println()
.b
- The boolean
to be printedpublic static void println(char c)
print(char)
and then
println()
.c
- The char
to be printed.public static void println(int i)
print(int)
and then
println()
.i
- The int
to be printed.public static void println(long l)
print(long)
and then
println()
.l
- a The long
to be printed.public static void println(float f)
print(float)
and then
println()
.f
- The float
to be printed.public static void println(double d)
print(double)
and then
println()
.d
- The double
to be printed.public static void println()
line.separator
, and is not necessarily a single newline
character ('\n'
).public static long vmStartTime()
public static long vmUptime()
public static long timeMillis()
public static long timeNanos()
This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary time (perhaps in the future, so values may be negative). This method provides nanosecond precision, but not necessarily nanosecond accuracy. No guarantees are made about how frequently values change. Differences in successive calls that span greater than approximately 292 years (263 nanoseconds) will not accurately compute elapsed time due to numerical overflow.
public static java.lang.String timestamp(java.lang.String format)
Generates a string getTimestamp (current date&time)
format
- The format to be used - see SimpleDateFormatpublic static java.lang.String timestamp()
Generates a string getTimestamp (current date&time) in the default system format
public static boolean startsWith(java.lang.String s, java.lang.String start)
public static boolean endsWith(java.lang.String s, java.lang.String end)
public static java.lang.String strcat(java.lang.String str1, java.lang.String str2)
concat(String, String)
public static java.lang.String concat(java.lang.String str1, java.lang.String str2)
public static int compareTo(java.lang.String str1, java.lang.String str2)
String
object is compared lexicographically to the
character sequence represented by the second string. The result is
a negative integer if the first String
object
lexicographically precedes the second string. The result is a
positive integer if the first String
object lexicographically
follows the second string. The result is zero if the strings
are equal; compareTo
returns 0
exactly when
the String.equals(Object)
method would return true
.public static int strcmp(java.lang.String str1, java.lang.String str2)
public static int compareToIgnoreCase(java.lang.String str1, java.lang.String str2)
compareTo
with normalized versions of the strings
where case differences have been eliminated by calling
Character.toLowerCase(Character.toUpperCase(character))
on
each character.public static int stricmp(java.lang.String str1, java.lang.String str2)
public static int strstr(java.lang.String str1, java.lang.String str2)
public static int indexOf(java.lang.String str1, java.lang.String str2)
public static int lastIndexOf(java.lang.String str1, java.lang.String str2)
public static java.lang.String substr(java.lang.String str, int start, int length)
public static java.lang.String substr(java.lang.String str, int start)
public static int length(java.lang.String str)
str
- String whose length is calculated.public static int strlen(java.lang.String str)
length(String)
public static java.util.regex.Pattern regexp(java.lang.String regex)
regex
- The expression to be compiledjava.util.regex.PatternSyntaxException
- If the expression's syntax is invalidpublic static java.util.regex.Pattern pattern(java.lang.String regex)
regexp(String)
public static java.util.regex.Pattern regexp(java.lang.String regex, int flags)
regex
- The expression to be compiledflags
- Match flags, a bit mask that may include
Pattern.CASE_INSENSITIVE
, Pattern.MULTILINE
, Pattern.DOTALL
,
Pattern.UNICODE_CASE
, Pattern.CANON_EQ
, Pattern.UNIX_LINES
,
Pattern.LITERAL
and Pattern.COMMENTS
java.lang.IllegalArgumentException
- If bit values other than those corresponding to the defined
match flags are set in flagsjava.util.regex.PatternSyntaxException
- If the expression's syntax is invalidpublic static java.util.regex.Pattern pattern(java.lang.String regex, int flags)
regexp(String, int)
public static boolean matches(java.util.regex.Pattern regex, java.lang.String input)
public static boolean matches(java.lang.String regex, java.lang.String input)
An invocation of this convenience method of the form
behaves in exactly the same way as the expressionPattern.matches(regex, input);
Pattern.compile(regex).matcher(input).matches()
If a pattern is to be used multiple times, compiling it once and reusing it will be more efficient than invoking this method each time.
regex
- The expression to be compiledinput
- The character sequence to be matchedjava.util.regex.PatternSyntaxException
- If the expression's syntax is invalidpublic static double random()
double
value with a positive sign, greater
than or equal to 0.0
and less than 1.0
.
Returned values are chosen pseudorandomly with (approximately)
uniform distribution from that range.public static double log(double a)
double
value. Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- a valuea
, the natural logarithm of
a
.public static double log10(double a)
double
value.
Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- a valuea
.public static double exp(double a)
double
value. Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- the exponent to raise e to.a
,
where e is the base of the natural logarithms.public static boolean isNaN(double d)
true
if the specified number is a
Not-a-Number (NaN) value, false
otherwise.d
- the value to be tested.true
if the value of the argument is NaN;
false
otherwise.public static boolean isNaN(float f)
true
if the specified number is a
Not-a-Number (NaN) value, false
otherwise.f
- the value to be tested.true
if the value of the argument is NaN;
false
otherwise.public static boolean isInfinite(double d)
true
if the specified number is infinitely
large in magnitude, false
otherwise.d
- the value to be tested.true
if the value of the argument is positive
infinity or negative infinity; false
otherwise.public static boolean isInfinite(float f)
true
if the specified number is infinitely
large in magnitude, false
otherwise.f
- the value to be tested.true
if the value of the argument is positive
infinity or negative infinity; false
otherwise.public static boolean parseBoolean(java.lang.String s)
boolean
returned represents the value true
if the string argument
is not null
and is equal, ignoring case, to the string
"true"
.
Example: Boolean.parseBoolean("True")
returns true.
Example: Boolean.parseBoolean("yes")
returns false.
s
- the String
containing the boolean
representation to be parsedpublic static byte parseByte(java.lang.String s)
byte
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
('\u002D'
) to
indicate a negative value. The resulting byte
value is
returned.s
- a String
containing the
byte
representation to be parsedbyte
value represented by the
argument in decimalpublic static short parseShort(java.lang.String s)
short
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
('\u002D'
) to
indicate a negative value. The resulting short
value is
returned.s
- a String
containing the short
representation to be parsedshort
value represented by the
argument in decimal.public static int parseInt(java.lang.String s)
'-'
('\u002D'
) to indicate a negative value. The resulting
integer value is returned.s
- a String
containing the int
representation to be parsedpublic static long parseLong(java.lang.String s)
long
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
(\u002D'
) to
indicate a negative value. The resulting long
value is returned.
Note that neither the character L
('\u004C'
) nor l
('\u006C'
) is permitted to appear at the end
of the string as a type indicator, as would be permitted in
Java programming language source code.
s
- a String
containing the long
representation to be parsedlong
represented by the argument in
decimal.public static float parseFloat(java.lang.String s)
float
initialized to the value
represented by the specified String
, as performed
by the valueOf
method of class Float
.s
- the string to be parsed.float
value represented by the string
argument.public static double parseDouble(java.lang.String s)
double
initialized to the value
represented by the specified String
, as performed
by the valueOf
methcod of class
Double
.s
- the string to be parsed.double
value represented by the string
argument.public static java.lang.Boolean box(boolean b)
b
- a boolean value.public static java.lang.Character box(char c)
c
- a char value.public static java.lang.Byte box(byte b)
b
- a byte value.public static java.lang.Short box(short s)
s
- a short value.public static java.lang.Integer box(int i)
i
- an int
value.public static java.lang.Long box(long l)
l
- a long value.public static java.lang.Float box(float f)
f
- a float value.public static java.lang.Double box(double d)
d
- a double value.public static boolean unbox(java.lang.Boolean b)
b
- the Boolean object whose value is returned.boolean
value of the object.public static char unbox(java.lang.Character ch)
ch
- the Character object whose value is returned.char
value of the object.public static byte unbox(java.lang.Byte b)
byte
.b
- Byte that is unboxedByte
.public static short unbox(java.lang.Short s)
Short
.s
- Short that is unboxed.Short
.public static int unbox(java.lang.Integer i)
Integer
.i
- Integer that is unboxed.Integer
.public static long unbox(java.lang.Long l)
Long
.l
- Long to be unboxed.Long
.public static float unbox(java.lang.Float f)
Float
.f
- Float to be unboxed.Float
.public static double unbox(java.lang.Double d)
Double
.d
- Double to be unboxed.public static java.lang.String str(boolean b)
true
, then
the string "true"
will be returned, otherwise the
string "false"
will be returned.b
- the boolean to be convertedboolean
public static java.lang.String str(char c)
String
object representing the
specified char
. The result is a string of length
1 consisting solely of the specified char
.c
- the char
to be convertedchar
public static java.lang.String str(int i)
String
object representing the
specified integer. The argument is converted to signed decimal
representation and returned as a string.i
- an integer to be converted.public static java.lang.String toHexString(int i)
The unsigned integer value is the argument plus 232
if the argument is negative; otherwise, it is equal to the
argument. This value is converted to a string of ASCII digits
in hexadecimal (base 16) with no extra leading
0
s. If the unsigned magnitude is zero, it is
represented by a single zero character '0'
('\u0030'
); otherwise, the first character of
the representation of the unsigned magnitude will not be the
zero character. The following characters are used as
hexadecimal digits:
These are the characters0123456789abcdef
'\u0030'
through
'\u0039'
and '\u0061'
through
'\u0066'
.i
- an integer to be converted to a string.public static java.lang.String str(long l)
String
object representing the specified
long
. The argument is converted to signed decimal
representation and returned as a string.l
- a long
to be converted.public static java.lang.String toHexString(long l)
long
argument as an unsigned integer in base 16.
The unsigned long
value is the argument plus
264 if the argument is negative; otherwise, it is
equal to the argument. This value is converted to a string of
ASCII digits in hexadecimal (base 16) with no extra
leading 0
s. If the unsigned magnitude is zero, it
is represented by a single zero character '0'
('\u0030'
); otherwise, the first character of
the representation of the unsigned magnitude will not be the
zero character. The following characters are used as
hexadecimal digits:
These are the characters0123456789abcdef
'\u0030'
through
'\u0039'
and '\u0061'
through
'\u0066'
.l
- a long
to be converted to a string.long
value represented by the argument in hexadecimal
(base 16).public static java.lang.String str(float f)
float
argument. All characters mentioned below are ASCII characters.
NaN
".
-
' ('\u002D'
); if the sign is
positive, no sign character appears in the result. As for
the magnitude m:
"Infinity"
; thus, positive infinity produces
the result "Infinity"
and negative infinity
produces the result "-Infinity"
.
"0.0"
; thus, negative zero produces the result
"-0.0"
and positive zero produces the result
"0.0"
.
.
'
('\u002E'
), followed by one or more
decimal digits representing the fractional part of
m.
.
' ('\u002E'
), followed by
decimal digits representing the fractional part of
a, followed by the letter 'E
'
('\u0045'
), followed by a representation
of n as a decimal integer, as produced by the
method Integer.toString(int)
.
float
. That is, suppose that x is the
exact mathematical value represented by the decimal
representation produced by this method for a finite nonzero
argument f. Then f must be the float
value nearest to x; or, if two float
values are
equally close to x, then f must be one of
them and the least significant bit of the significand of
f must be 0
.
f
- the float to be converted.public static java.lang.String str(double d)
double
argument. All characters mentioned below are ASCII characters.
NaN
".
-
'
('\u002D'
); if the sign is positive, no sign character
appears in the result. As for the magnitude m:
"Infinity"
; thus, positive infinity produces the result
"Infinity"
and negative infinity produces the result
"-Infinity"
.
"0.0"
; thus, negative zero produces the result
"-0.0"
and positive zero produces the result
"0.0"
.
.
' ('\u002E'
), followed by one or
more decimal digits representing the fractional part of m.
.
'
('\u002E'
), followed by decimal digits
representing the fractional part of a, followed by the
letter 'E
' ('\u0045'
), followed
by a representation of n as a decimal integer, as
produced by the method Integer.toString(int)
.
double
. That is, suppose that
x is the exact mathematical value represented by the decimal
representation produced by this method for a finite nonzero argument
d. Then d must be the double
value nearest
to x; or if two double
values are equally close
to x, then d must be one of them and the least
significant bit of the significand of d must be 0
.
d
- the double
to be converted.public static void exit(int exitCode)
exitCode
- exit value sent to the clientpublic static void exit()
exit(int)
public static long perfInt(java.lang.String name)
public static long perfLong(java.lang.String name)
public static java.lang.String perfString(java.lang.String name)
public static <K,V> java.util.Map<K,V> newHashMap()
public static <K,V> java.util.Map<K,V> newWeakMap()
public static <V> java.util.Deque<V> newDeque()
public static <K,V> V get(java.util.Map<K,V> map, java.lang.Object key)
public static <K,V> boolean containsKey(java.util.Map<K,V> map, java.lang.Object key)
public static <K,V> boolean containsValue(java.util.Map<K,V> map, java.lang.Object value)
public static <K,V> V put(java.util.Map<K,V> map, K key, V value)
public static <K,V> V remove(java.util.Map<K,V> map, java.lang.Object key)
public static <K,V> void clear(java.util.Map<K,V> map)
public static <K,V> int size(java.util.Map<K,V> map)
public static <K,V> boolean isEmpty(java.util.Map<K,V> map)
public static <E> int size(java.util.Collection<E> coll)
public static <E> boolean isEmpty(java.util.Collection<E> coll)
public static <E> boolean contains(java.util.Collection<E> coll, java.lang.Object obj)
public static boolean contains(java.lang.Object[] array, java.lang.Object value)
public static <V> void push(java.util.Deque<V> queue, V value)
public static <V> V poll(java.util.Deque<V> queue)
public static <V> V peek(java.util.Deque<V> queue)
public static <V> void addLast(java.util.Deque<V> queue, V value)
public static <V> V peekFirst(java.util.Deque<V> queue)
public static <V> V peekLast(java.util.Deque<V> queue)
public static <V> V removeLast(java.util.Deque<V> queue)
public static <V> V removeFirst(java.util.Deque<V> queue)
public static java.lang.String $(int n)
null
if not available.n
- command line argument indexpublic static int getpid()
public static int $length()
public static java.util.concurrent.atomic.AtomicInteger newAtomicInteger(int initialValue)
initialValue
- the initial valuepublic static int get(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger whose value is returned.public static void set(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is set.newValue
- the new valuepublic static void lazySet(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is lazily set.newValue
- the new valuepublic static boolean compareAndSet(java.util.concurrent.atomic.AtomicInteger ai, int expect, int update)
==
the expected value.ai
- AtomicInteger whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static boolean weakCompareAndSet(java.util.concurrent.atomic.AtomicInteger ai, int expect, int update)
==
the expected value.
May fail spuriously
and does not provide ordering guarantees, so is only rarely an
appropriate alternative to compareAndSet
.
ai
- AtomicInteger whose value is weakly compared and set.expect
- the expected valueupdate
- the new valuepublic static int getAndIncrement(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is incremented.public static int getAndDecrement(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is decremented.public static int incrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is incremented.public static int decrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger whose value is decremented.public static int getAndAdd(java.util.concurrent.atomic.AtomicInteger ai, int delta)
ai
- AtomicInteger whose value is added to.delta
- the value to addpublic static int addAndGet(java.util.concurrent.atomic.AtomicInteger ai, int delta)
ai
- AtomicInteger whose value is added to.delta
- the value to addpublic static int getAndSet(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is set.newValue
- the new valuepublic static java.util.concurrent.atomic.AtomicLong newAtomicLong(long initialValue)
initialValue
- the initial valuepublic static long get(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is returned.public static void set(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong whose value is set.newValue
- the new valuepublic static void lazySet(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong whose value is set.newValue
- the new valuepublic static boolean compareAndSet(java.util.concurrent.atomic.AtomicLong al, long expect, long update)
==
the expected value.al
- AtomicLong whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static boolean weakCompareAndSet(java.util.concurrent.atomic.AtomicLong al, long expect, long update)
==
the expected value.
May fail spuriously
and does not provide ordering guarantees, so is only rarely an
appropriate alternative to compareAndSet
.
al
- AtomicLong whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static long getAndIncrement(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is incremented.public static long getAndDecrement(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is decremented.public static long incrementAndGet(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is incremented.public static long decrementAndGet(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is decremented.public static long getAndAdd(java.util.concurrent.atomic.AtomicLong al, long delta)
al
- AtomicLong whose value is added to.delta
- the value to addpublic static long addAndGet(java.util.concurrent.atomic.AtomicLong al, long delta)
al
- AtomicLong whose value is added todelta
- the value to addpublic static long getAndSet(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong that is set.newValue
- the new valuepublic static int dtraceProbe(java.lang.String str1, java.lang.String str2)
dtraceProbe(String,String,int,int)
public static int dtraceProbe(java.lang.String str1, java.lang.String str2, int i1)
dtraceProbe(String,String,int,int)
public static int dtraceProbe(java.lang.String str1, java.lang.String str2, int i1, int i2)
str1
- first String param to DTrace probestr2
- second String param to DTrace probei1
- first int param to DTrace probei2
- second int param to DTrace probepublic static java.lang.String property(java.lang.String key)
key
- the name of the system property.null
if there is no property with that key.java.lang.NullPointerException
- if key
is
null
.java.lang.IllegalArgumentException
- if key
is empty.public static java.util.Properties properties()
public static void printProperties()
public static java.lang.String getenv(java.lang.String name)
name
- the name of the environment variablenull
if the variable is not defined in the system environmentjava.lang.NullPointerException
- if name
is null
public static java.util.Map<java.lang.String,java.lang.String> getenv()
public static void printEnv()
public static long availableProcessors()
This value may change during a particular invocation of the virtual machine. Applications that are sensitive to the number of available processors should therefore occasionally poll this property and adjust their resource usage appropriately.
public static long freeMemory()
gc
method may result in increasing the value returned
by freeMemory.
public static long totalMemory()
Note that the amount of memory required to hold an object of any given type may be implementation-dependent.
public static long maxMemory()
Long.MAX_VALUE
will be returned. public static java.lang.management.MemoryUsage heapUsage()
public static java.lang.management.MemoryUsage nonHeapUsage()
public static long init(java.lang.management.MemoryUsage mu)
public static long committed(java.lang.management.MemoryUsage mu)
public static long max(java.lang.management.MemoryUsage mu)
public static long used(java.lang.management.MemoryUsage mu)
public static long finalizationCount()
public static java.util.List<java.lang.String> vmArguments()
Some Java virtual machine implementations may take input arguments from multiple different sources: for examples, arguments passed from the application that launches the Java virtual machine such as the 'java' command, environment variables, configuration files, etc.
Typically, not all command-line options to the 'java' command are passed to the Java virtual machine. Thus, the returned input arguments may not include all command-line options.
public static void printVmArguments()
vmArguments()
public static java.lang.String vmVersion()
public static boolean isBootClassPathSupported()
public static java.lang.String bootClassPath()
Multiple paths in the boot class path are separated by the path separator character of the platform on which the Java virtual machine is running.
A Java virtual machine implementation may not support
the boot class path mechanism for the bootstrap class loader
to search for class files.
The isBootClassPathSupported()
method can be used
to determine if the Java virtual machine supports this method.
java.lang.UnsupportedOperationException
- if the Java virtual machine does not support this operation.public static java.lang.String classPath()
public static java.lang.String libraryPath()
Multiple paths in the Java library path are separated by the path separator character of the platform of the Java virtual machine being monitored.
public static long threadCount()
public static long peakThreadCount()
public static long totalStartedThreadCount()
public static long daemonThreadCount()
public static long currentThreadCpuTime()
public static long currentThreadUserTime()
public static long getTotalGcTime()
public static long sizeof(java.lang.Object objectToSize)
objectToSize
- the object to sizejava.lang.NullPointerException
- if the supplied Object is null
.public static void dumpHeap(java.lang.String fileName)
fileName
- name of the file to which heap is dumpedpublic static void dumpHeap(java.lang.String fileName, boolean live)
fileName
- name of the file to which heap is dumpedlive
- flag that tells whether only live objects are
to be dumped or all objects are to be dumped.public static void gc()
Calling the gc
method suggests that the Java Virtual
Machine expend effort toward recycling unused objects in order to
make the memory they currently occupy available for quick reuse.
When control returns from the method call, the Java Virtual
Machine has made a best effort to reclaim space from all discarded
objects. This method calls Sys.gc() to perform GC.
public static void runFinalization()
Calling this method suggests that the Java Virtual Machine expend
effort toward running the finalize
methods of objects
that have been found to be discarded but whose finalize
methods have not yet been run. When control returns from the
method call, the Java Virtual Machine has made a best effort to
complete all outstanding finalizations. This method calls
Sys.runFinalization() to run finalization.
public static void serialize(java.io.Serializable obj, java.lang.String fileName)
obj
- object that has to be serialized.fileName
- name of the file to which the object is serialized.public static java.lang.String toXML(java.lang.Object obj)
public static void writeXML(java.lang.Object obj, java.lang.String fileName)
public static void writeDOT(java.lang.Object obj, java.lang.String fileName)
public static int speculation()
public static void speculate(int id)
id
- the speculative buffer idpublic static void commit(int id)
id
- the speculative buffer idpublic static void discard(int id)
id
- the speculative buffer idpublic static Aggregation newAggregation(AggregationFunction type)
type
- the aggregating function to be performed on the data being added to the aggregation.public static AggregationKey newAggregationKey(java.lang.Object element1)
element1
- the value of the aggregation keypublic static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2)
element1
- the first element of the composite aggregation keyelement2
- the second element of the composite aggregation keypublic static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
element1
- the first element of the composite aggregation keyelement2
- the second element of the composite aggregation keyelement3
- the third element of the composite aggregation keypublic static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3, java.lang.Object element4)
element1
- the first element of the composite aggregation keyelement2
- the second element of the composite aggregation keyelement3
- the third element of the composite aggregation keyelement4
- the fourth element of the composite aggregation keypublic static void addToAggregation(Aggregation aggregation, long value)
aggregation
- the aggregation to which the value should be addedpublic static void addToAggregation(Aggregation aggregation, AggregationKey key, long value)
aggregation
- the aggregation to which the value should be addedkey
- the grouping aggregation keypublic static void clearAggregation(Aggregation aggregation)
aggregation
- the aggregation to be clearedpublic static void truncateAggregation(Aggregation aggregation, int count)
abs(count)
elements.
If count
is positive, the largest aggregated values in the aggregation will be
preserved. If count
is negative the smallest values will be preserved. If count
is zero then all elements will be removed.
Behavior is intended to be similar to the dtrace trunc()
function.
aggregation
- the aggregation to be truncatedcount
- the number of elements to preserve. If negative, the smallest abs(count)
elements are preserved.public static void printAggregation(java.lang.String name, Aggregation aggregation)
public static void printAggregation(java.lang.String name, Aggregation aggregation, java.lang.String format)
name
- The name of the aggregation to be used in the textual outputaggregation
- The aggregation to printformat
- The format to use. It mimics String.format(java.lang.String, java.lang.Object[]) behaviour
with the addition of the ability to address the key title as a 0-indexed itemString.format(java.lang.String, java.lang.Object[])