com.sun.btrace
Class BTraceUtils

java.lang.Object
  extended by com.sun.btrace.BTraceUtils

public class BTraceUtils
extends java.lang.Object

This class is an all-in-one wrapper for BTrace DSL methods

Author:
A. Sundararajan, Jaroslav Bachorik

Nested Class Summary
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
           
 
Method Summary
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.Character box(char c)
          Returns a Character instance representing the specified char 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.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! After exit call, the trace action method terminates immediately and no other probe action method (of that client) will be called after that.
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 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 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 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(char c)
          Prints a character.
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(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(char c)
          Prints a character 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(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(char c)
          Returns a String object representing the specified char.
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(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 char unbox(java.lang.Character ch)
          Returns the value of the given Character object as a char primitive.
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 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.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isInteruppted

public static boolean isInteruppted()
Tests whether this thread has been interrupted. The interrupted status of the thread is unaffected by this method.

A thread interruption ignored because a thread was not alive at the time of the interrupt will be reflected by this method returning false.

Returns:
true if this thread has been interrupted; false otherwise.

jstack

public static void jstack()
Prints the java stack trace of the current thread.


jstack

public static void jstack(int numFrames)
Prints the java stack trace of the current thread. But, atmost given number of frames.

Parameters:
numFrames - number of frames to be printed. When this is negative all frames are printed.

jstackAll

public static void jstackAll()
Prints Java stack traces of all the Java threads.


jstackAll

public static void jstackAll(int numFrames)
Prints Java stack traces of all the Java threads. But, atmost given number of frames.

Parameters:
numFrames - number of frames to be printed. When this is negative all frames are printed.

jstackStr

public static java.lang.String jstackStr()
Returns the stack trace of current thread as a String.

Returns:
the stack trace as a String.

jstackStr

public 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.

Parameters:
numFrames - number of frames to be included. When this is negative all frames are included.
Returns:
the stack trace as a String.

jstackAllStr

public static java.lang.String jstackAllStr()
Returns the stack traces of all Java threads as a String.

Returns:
the stack traces as a String.

jstackAllStr

public static java.lang.String jstackAllStr(int numFrames)
Returns atmost given number of frames in stack traces of all threads as a String.

Parameters:
numFrames - number of frames to be included. When this is negative all frames are included.
Returns:
the stack traces as a String.

jstack

public static void jstack(java.lang.Throwable exception)
Prints the stack trace of the given exception object.

Parameters:
exception - throwable for which stack trace is printed.

jstack

public static void jstack(java.lang.Throwable exception,
                          int numFrames)
Prints the stack trace of the given exception object. But, prints atmost given number of frames.

Parameters:
exception - throwable for which stack trace is printed.
numFrames - maximum number of frames to be printed.

jstackStr

public static java.lang.String jstackStr(java.lang.Throwable exception)
Returns the stack trace of given exception object as a String.

Parameters:
exception - the throwable for which stack trace is returned.

jstackStr

public static java.lang.String jstackStr(java.lang.Throwable exception,
                                         int numFrames)
Returns stack trace of given exception object as a String.

Parameters:
exception - throwable for which stack trace is returned.
numFrames - maximum number of frames to be returned.

currentThread

public static java.lang.Thread currentThread()
Returns a reference to the currently executing thread object.

Returns:
the currently executing thread.

threadId

public static long threadId(java.lang.Thread thread)
Returns the identifier of the given Thread. The thread ID is a positive long number generated when the given thread was created. The thread ID is unique and remains unchanged during its lifetime. When a thread is terminated, the thread ID may be reused.


threadState

public static java.lang.Thread.State threadState(java.lang.Thread thread)
Returns the state of the given thread. This method is designed for use in monitoring of the system state, not for synchronization control.


holdsLock

public static boolean holdsLock(java.lang.Object obj)
Returns true if and only if the current thread holds the monitor lock on the specified object.

This method is designed to allow a program to assert that the current thread already holds a specified lock:

     assert Thread.holdsLock(obj);
 

Parameters:
obj - the object on which to test lock ownership
Returns:
true if the current thread holds the monitor lock on the specified object.
Throws:
java.lang.NullPointerException - if obj is null

deadlocks

public static void deadlocks()
Prints the Java level deadlocks detected (if any).


deadlocks

public static void deadlocks(boolean stackTrace)
Prints deadlocks detected (if any). Optionally prints stack trace of the deadlocked threads.

Parameters:
stackTrace - boolean flag to specify whether to print stack traces of deadlocked threads or not.

name

public static java.lang.String name(java.lang.Thread thread)
Returns the name of the given thread.

Parameters:
thread - thread whose name is returned

loader

public static java.lang.ClassLoader loader(java.lang.Class clazz)
Returns the class loader for the given class. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader.

Parameters:
clazz - the Class for which the class loader is returned

parentLoader

public static java.lang.ClassLoader parentLoader(java.lang.ClassLoader loader)
Returns the parent class loader of the given loader. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class loader's parent is the bootstrap class loader.

Parameters:
loader - the loader for which the parent loader is returned
Returns:
The parent ClassLoader

str

public static java.lang.String str(java.lang.Object obj)
Returns a string representation of the object. In general, the 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.

Parameters:
obj - the object whose string representation is returned
Returns:
a string representation of the given object.

identityStr

public static java.lang.String identityStr(java.lang.Object obj)
Returns identity string of the form class-name@identity-hash

Parameters:
obj - object for which identity string is returned
Returns:
identity string

hash

public static int hash(java.lang.Object obj)
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. For bootstrap classes, returns the result of calling Object.hashCode() override. For non-bootstrap classes, the identity hash code is returned.

Parameters:
obj - the Object whose hash code is returned.
Returns:
a hash code value for the given object.

identityHashCode

public 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(). The hash code for the null reference is zero.

Parameters:
obj - object for which the hashCode is to be calculated
Returns:
the hashCode

compare

public static boolean compare(java.lang.Object obj1,
                              java.lang.Object obj2)
Indicates whether two given objects are "equal to" one another. For bootstrap classes, returns the result of calling Object.equals() override. For non-bootstrap classes, the reference identity comparison is done.

Parameters:
obj1 - first object to compare equality
obj2 - second object to compare equality
Returns:
true if the given objects are equal; false otherwise.

classOf

public static java.lang.Class classOf(java.lang.Object obj)
Returns the runtime class of the given Object.

Parameters:
obj - the Object whose Class is returned
Returns:
the Class object of given object

declaringClass

public 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.

Parameters:
field - whose declaring Class is returned

name

public static java.lang.String name(java.lang.Class clazz)
Returns the name of the given Class object.


name

public static java.lang.String name(java.lang.reflect.Field field)
Returns the name of the Field object.

Parameters:
field - Field for which name is returned
Returns:
name of the given field

type

public static java.lang.Class type(java.lang.reflect.Field field)
Returns the type of the Field object.

Parameters:
field - Field for which type is returned
Returns:
type of the given field

accessFlags

public static int accessFlags(java.lang.Class clazz)
Returns the access flags of the given Class.


accessFlags

public static int accessFlags(java.lang.reflect.Field field)
Returns the access flags of the given Field.


contextClassLoader

public static java.lang.ClassLoader contextClassLoader()
Returns the current context class loader


classForName

public static java.lang.Class classForName(java.lang.String name)
Returns Class object for given class name.


classForName

public 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.


isAssignableFrom

public 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. It returns true if so; otherwise it returns false.


isInstance

public 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. 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.

Parameters:
clazz - the class that is checked.
obj - the object to check.
Returns:
true if obj is an instance of the given class.

getSuperclass

public 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. 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.

Parameters:
clazz - the Class whose super class is returned.
Returns:
the superclass of the class represented by the given object.

isInterface

public static boolean isInterface(java.lang.Class clazz)
Determines if the specified Class object represents an interface type.

Parameters:
clazz - the Class object to check.
Returns:
true if the Class represents an interface; false otherwise.

isArray

public static boolean isArray(java.lang.Class clazz)
Determines if the given Class object represents an array class.

Parameters:
clazz - Class object to check.
Returns:
true if the given object represents an array class; false otherwise.

isPrimitive

public static boolean isPrimitive(java.lang.Class clazz)
Returns whether the given Class represent primitive type or not.


getComponentType

public static java.lang.Class getComponentType(java.lang.Class clazz)
returns component type of an array Class.


field

public 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. 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.

Parameters:
clazz - Class whose field is returned
name - the name of the field
throwException - whether to throw exception on failing to find field or not
Returns:
the Field object for the specified field in this class

field

public 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. The name parameter is a String that specifies the simple name of the desired field. Throws a RuntimeException when field is not found.

Parameters:
clazz - Class whose field is returned
name - the name of the field
Returns:
the Field object for the specified field in this class

field

public 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. 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.

Parameters:
clazz - Class whose field is returned
name - the name of the field
throwException - whether to throw exception on failing to find field or not
Returns:
the Field object for the specified field in this class

field

public 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. The name parameter is a String that specifies the simple name of the desired field. Throws a RuntimeException when field is not found.

Parameters:
clazz - Class whose field is returned
name - the name of the field
Returns:
the Field object for the specified field in this class

getByte

public static byte getByte(java.lang.reflect.Field field)
Gets the value of a static byte field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the byte field

getByte

public static byte getByte(java.lang.reflect.Field field,
                           java.lang.Object obj)
Gets the value of an instance byte field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the byte value from
Returns:
the value of the byte field

getShort

public static short getShort(java.lang.reflect.Field field)
Gets the value of a static short field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the short field

getShort

public static short getShort(java.lang.reflect.Field field,
                             java.lang.Object obj)
Gets the value of an instance short field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the short value from
Returns:
the value of the short field

getInt

public static int getInt(java.lang.reflect.Field field)
Gets the value of a static int field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the int field

getInt

public static int getInt(java.lang.reflect.Field field,
                         java.lang.Object obj)
Gets the value of an instance int field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the int value from
Returns:
the value of the int field

getLong

public static long getLong(java.lang.reflect.Field field)
Gets the value of a static long field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the long field

getLong

public static long getLong(java.lang.reflect.Field field,
                           java.lang.Object obj)
Gets the value of an instance long field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the long value from
Returns:
the value of the long field

getFloat

public static float getFloat(java.lang.reflect.Field field)
Gets the value of a static float field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the float field

getFloat

public static float getFloat(java.lang.reflect.Field field,
                             java.lang.Object obj)
Gets the value of an instance float field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the float value from
Returns:
the value of the float field

getDouble

public static double getDouble(java.lang.reflect.Field field)
Gets the value of a static double field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the double field

getDouble

public static double getDouble(java.lang.reflect.Field field,
                               java.lang.Object obj)
Gets the value of an instance double field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the double value from
Returns:
the value of the double field

getBoolean

public static boolean getBoolean(java.lang.reflect.Field field)
Gets the value of a static boolean field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the boolean field

getBoolean

public static boolean getBoolean(java.lang.reflect.Field field,
                                 java.lang.Object obj)
Gets the value of an instance boolean field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the boolean value from
Returns:
the value of the boolean field

getChar

public static char getChar(java.lang.reflect.Field field)
Gets the value of a static char field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the char field

getChar

public static char getChar(java.lang.reflect.Field field,
                           java.lang.Object obj)
Gets the value of an instance char field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the char value from
Returns:
the value of the char field

get

public static java.lang.Object get(java.lang.reflect.Field field)
Gets the value of a static reference field.

Parameters:
field - Field object whose value is returned.
Returns:
the value of the reference field

get

public static java.lang.Object get(java.lang.reflect.Field field,
                                   java.lang.Object obj)
Gets the value of an instance reference field.

Parameters:
field - Field object whose value is returned.
obj - the object to extract the reference value from
Returns:
the value of the reference field

weakRef

public static java.lang.ref.WeakReference weakRef(java.lang.Object obj)
Creates and returns a weak reference to the given object.

Parameters:
obj - object for which a weak reference is created.
Returns:
a weak reference to the given object.

softRef

public static java.lang.ref.SoftReference softRef(java.lang.Object obj)
Creates and returns a soft reference to the given object.

Parameters:
obj - object for which a soft reference is created.
Returns:
a soft reference to the given object.

deref

public static java.lang.Object deref(java.lang.ref.Reference ref)
Returns the given reference object's referent. If the reference object has been cleared, either by the program or by the garbage collector, then this method returns null.

Parameters:
ref - reference object whose referent is returned.
Returns:
The object to which the reference refers, or null if the reference object has been cleared.

probeClass

public static java.lang.Class probeClass()
Deprecated. Since 1.1. Use ProbeClassName and Self annotations instead

Returns the Class object of the currently probed (or traced) class.


probeMethod

@Deprecated
public static java.lang.String probeMethod()
Deprecated. Since 1.1. Use ProbeMethodName annotation instead

Returns the currently probed method's name.


probeLine

public static int probeLine()
Returns the currently probed source line number (if available).


printMap

public static void printMap(java.util.Map map)
Prints the given Map.

Parameters:
map - Map that is printed.

printStringMap

public static void printStringMap(java.lang.String name,
                                  java.util.Map<java.lang.String,java.lang.String> data)
Prints the given Map.

Parameters:
name - - the name of the map
data - - the map data

printNumberMap

public static void printNumberMap(java.lang.String name,
                                  java.util.Map<java.lang.String,? extends java.lang.Number> data)
Prints the given Map.

Parameters:
name - - the name of the map
data - - the map data

printNumber

public static void printNumber(java.lang.String name,
                               java.lang.Number value)
Prints a number.

Parameters:
name - - name of the number data
value - - value of the numerical data

printArray

public static void printArray(java.lang.Object[] array)
Prints the elements of the given array as comma separated line bounded by '[' and ']'.


printFields

public static void printFields(java.lang.Object obj)
Print all instance fields of an object as name-value pairs. Includes the inherited fields as well.

Parameters:
obj - Object whose fields are printed.

printFields

public static void printFields(java.lang.Object obj,
                               boolean classNamePrefix)
Print all instance fields of an object as name-value pairs. Includes the inherited fields as well. Optionally, prints name of the declaring class before each field - so that if same named field in super class chain may be disambiguated.

Parameters:
obj - Object whose fields are printed.
classNamePrefix - flag to tell whether to prefix field names names by class name or not.

printStaticFields

public static void printStaticFields(java.lang.Class clazz)
Print all static fields of the class as name-value pairs. Includes the inherited fields as well.

Parameters:
clazz - Class whose static fields are printed.

printStaticFields

public static void printStaticFields(java.lang.Class clazz,
                                     boolean classNamePrefix)
Print all static fields of the class as name-value pairs. Includes the inherited fields as well. Optionally, prints name of the declaring class before each field - so that if same named field in super class chain may be disambiguated.

Parameters:
clazz - Class whose static fields are printed.
classNamePrefix - flag to tell whether to prefix field names names by class name or not.

print

public static void print(java.lang.Object obj)

print

public static void print(boolean b)
Prints a boolean value. The string produced by String.valueOf(boolean) is sent to BTrace client for "printing".

Parameters:
b - The boolean to be printed

print

public static void print(char c)
Prints a character. The string produced by Character.valueOf(char) is sent to BTrace client for "printing".

Parameters:
c - The char to be printed

print

public static void print(int i)
Prints an integer. The string produced by String.valueOf(int) is sent to BTrace client for "printing".

Parameters:
i - The int to be printed
See Also:
Integer.toString(int)

print

public static void print(long l)
Prints a long integer. The string produced by String.valueOf(long) is sent to BTrace client for "printing".

Parameters:
l - The long to be printed
See Also:
Long.toString(long)

print

public static void print(float f)
Prints a floating-point number. The string produced by String.valueOf(float) is sent to BTrace client for "printing".

Parameters:
f - The float to be printed
See Also:
Float.toString(float)

print

public static void print(double d)
Prints a double-precision floating-point number. The string produced by String.valueOf(double) is sent to BTrace client for "printing".

Parameters:
d - The double to be printed
See Also:
Double.toString(double)

println

public static void println(java.lang.Object obj)
Prints the given object and then prints a newline


println

public static void println(boolean b)
Prints a boolean and then terminate the line. This method behaves as though it invokes print(boolean) and then println().

Parameters:
b - The boolean to be printed

println

public static void println(char c)
Prints a character and then terminate the line. This method behaves as though it invokes print(char) and then println().

Parameters:
c - The char to be printed.

println

public static void println(int i)
Prints an integer and then terminate the line. This method behaves as though it invokes print(int) and then println().

Parameters:
i - The int to be printed.

println

public static void println(long l)
Prints a long and then terminate the line. This method behaves as though it invokes print(long) and then println().

Parameters:
l - a The long to be printed.

println

public static void println(float f)
Prints a float and then terminate the line. This method behaves as though it invokes print(float) and then println().

Parameters:
f - The float to be printed.

println

public static void println(double d)
Prints a double and then terminate the line. This method behaves as though it invokes print(double) and then println().

Parameters:
d - The double to be printed.

println

public static void println()
Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').


vmStartTime

public static long vmStartTime()
Returns the start time of the Java virtual machine in milliseconds. This method returns the approximate time when the Java virtual machine started.

Returns:
start time of the Java virtual machine in milliseconds.

vmUptime

public static long vmUptime()
Returns the uptime of the Java virtual machine in milliseconds.

Returns:
uptime of the Java virtual machine in milliseconds.

timeMillis

public static long timeMillis()
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.

Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

timeNanos

public static long timeNanos()
Returns the current value of the most precise available system timer, in nanoseconds.

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.

Returns:
The current value of the system timer, in nanoseconds.

timestamp

public static java.lang.String timestamp(java.lang.String format)

Generates a string getTimestamp (current date&time)

Parameters:
format - The format to be used - see SimpleDateFormat
Returns:
Returns a string representing current date&time
Since:
1.1

timestamp

public static java.lang.String timestamp()

Generates a string getTimestamp (current date&time) in the default system format

Returns:
Returns a string representing current date&time
Since:
1.1

startsWith

public static boolean startsWith(java.lang.String s,
                                 java.lang.String start)

endsWith

public static boolean endsWith(java.lang.String s,
                               java.lang.String end)

strcat

public static java.lang.String strcat(java.lang.String str1,
                                      java.lang.String str2)
This is synonym to "concat".

See Also:
concat(String, String)

concat

public static java.lang.String concat(java.lang.String str1,
                                      java.lang.String str2)
Concatenates the specified strings together.


compareTo

public static int compareTo(java.lang.String str1,
                            java.lang.String str2)
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by the first 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.


strcmp

public static int strcmp(java.lang.String str1,
                         java.lang.String str2)
This is synonym to "compareTo" method.

See Also:
compareTo(java.lang.String, java.lang.String)

compareToIgnoreCase

public static int compareToIgnoreCase(java.lang.String str1,
                                      java.lang.String str2)
Compares two strings lexicographically, ignoring case differences. This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character.toLowerCase(Character.toUpperCase(character)) on each character.


stricmp

public static int stricmp(java.lang.String str1,
                          java.lang.String str2)
This is synonym to "compareToIgnoreCase".

See Also:
compareToIgnoreCase(java.lang.String, java.lang.String)

strstr

public static int strstr(java.lang.String str1,
                         java.lang.String str2)
Find String within String


indexOf

public static int indexOf(java.lang.String str1,
                          java.lang.String str2)

lastIndexOf

public static int lastIndexOf(java.lang.String str1,
                              java.lang.String str2)

substr

public static java.lang.String substr(java.lang.String str,
                                      int start,
                                      int length)
Substring


substr

public static java.lang.String substr(java.lang.String str,
                                      int start)

length

public static int length(java.lang.String str)
Returns the length of the given string. The length is equal to the number of Unicode code units in the string.

Parameters:
str - String whose length is calculated.
Returns:
the length of the sequence of characters represented by this object.

strlen

public static int strlen(java.lang.String str)
This is synonym for "length".

See Also:
length(String)

regexp

public static java.util.regex.Pattern regexp(java.lang.String regex)
Compiles the given regular expression into a pattern.

Parameters:
regex - The expression to be compiled
Throws:
java.util.regex.PatternSyntaxException - If the expression's syntax is invalid

pattern

public static java.util.regex.Pattern pattern(java.lang.String regex)
This is synonym for "regexp".

See Also:
regexp(String)

regexp

public static java.util.regex.Pattern regexp(java.lang.String regex,
                                             int flags)
Compiles the given regular expression into a pattern with the given flags.

Parameters:
regex - The expression to be compiled
flags - 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
Throws:
java.lang.IllegalArgumentException - If bit values other than those corresponding to the defined match flags are set in flags
java.util.regex.PatternSyntaxException - If the expression's syntax is invalid

pattern

public static java.util.regex.Pattern pattern(java.lang.String regex,
                                              int flags)
This is synonym for "regexp".

See Also:
regexp(String, int)

matches

public 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.


matches

public 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.

An invocation of this convenience method of the form

 Pattern.matches(regex, input);
behaves in exactly the same way as the expression
 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.

Parameters:
regex - The expression to be compiled
input - The character sequence to be matched
Throws:
java.util.regex.PatternSyntaxException - If the expression's syntax is invalid

random

public static double random()
Returns a 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.


log

public static double log(double a)
Returns the natural logarithm (base e) of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - a value
Returns:
the value ln a, the natural logarithm of a.

log10

public static double log10(double a)
Returns the base 10 logarithm of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - a value
Returns:
the base 10 logarithm of a.

exp

public static double exp(double a)
Returns Euler's number e raised to the power of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - the exponent to raise e to.
Returns:
the value ea, where e is the base of the natural logarithms.

isNaN

public static boolean isNaN(double d)
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Parameters:
d - the value to be tested.
Returns:
true if the value of the argument is NaN; false otherwise.

isNaN

public static boolean isNaN(float f)
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Parameters:
f - the value to be tested.
Returns:
true if the value of the argument is NaN; false otherwise.

isInfinite

public static boolean isInfinite(double d)
Returns true if the specified number is infinitely large in magnitude, false otherwise.

Parameters:
d - the value to be tested.
Returns:
true if the value of the argument is positive infinity or negative infinity; false otherwise.

isInfinite

public static boolean isInfinite(float f)
Returns true if the specified number is infinitely large in magnitude, false otherwise.

Parameters:
f - the value to be tested.
Returns:
true if the value of the argument is positive infinity or negative infinity; false otherwise.

parseBoolean

public static boolean parseBoolean(java.lang.String s)
Parses the string argument as a boolean. The 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.

Parameters:
s - the String containing the boolean representation to be parsed
Returns:
the boolean represented by the string argument

parseByte

public static byte parseByte(java.lang.String s)
Parses the string argument as a signed decimal 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.

Parameters:
s - a String containing the byte representation to be parsed
Returns:
the byte value represented by the argument in decimal

parseShort

public static short parseShort(java.lang.String s)
Parses the string argument as a signed decimal 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.

Parameters:
s - a String containing the short representation to be parsed
Returns:
the short value represented by the argument in decimal.

parseInt

public static int parseInt(java.lang.String s)
Parses the string argument as a signed decimal integer. 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 integer value is returned.

Parameters:
s - a String containing the int representation to be parsed
Returns:
the integer value represented by the argument in decimal.

parseLong

public static long parseLong(java.lang.String s)
Parses the string argument as a signed decimal 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.

Parameters:
s - a String containing the long representation to be parsed
Returns:
the long represented by the argument in decimal.

parseFloat

public 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.

Parameters:
s - the string to be parsed.
Returns:
the float value represented by the string argument.

parseDouble

public 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.

Parameters:
s - the string to be parsed.
Returns:
the double value represented by the string argument.

box

public static java.lang.Boolean box(boolean b)
Returns a Boolean instance representing the specified boolean value. If the specified boolean value is true, this method returns Boolean.TRUE; if it is false, this method returns Boolean.FALSE.

Parameters:
b - a boolean value.
Returns:
a Boolean instance representing b.

box

public static java.lang.Character box(char c)
Returns a Character instance representing the specified char value.

Parameters:
c - a char value.
Returns:
a Character instance representing c.

box

public static java.lang.Byte box(byte b)
Returns a Byte instance representing the specified byte value.

Parameters:
b - a byte value.
Returns:
a Byte instance representing b.

box

public static java.lang.Short box(short s)
Returns a Short instance representing the specified short value.

Parameters:
s - a short value.
Returns:
a Short instance representing s.

box

public static java.lang.Integer box(int i)
Returns a Integer instance representing the specified int value.

Parameters:
i - an int value.
Returns:
a Integer instance representing i.

box

public static java.lang.Long box(long l)
Returns a Long instance representing the specified long value.

Parameters:
l - a long value.
Returns:
a Long instance representing l.

box

public static java.lang.Float box(float f)
Returns a Float instance representing the specified float value.

Parameters:
f - a float value.
Returns:
a Float instance representing f.

box

public static java.lang.Double box(double d)
Returns a Double instance representing the specified double value.

Parameters:
d - a double value.
Returns:
a Double instance representing d.

unbox

public static boolean unbox(java.lang.Boolean b)
Returns the value of the given Boolean object as a boolean primitive.

Parameters:
b - the Boolean object whose value is returned.
Returns:
the primitive boolean value of the object.

unbox

public static char unbox(java.lang.Character ch)
Returns the value of the given Character object as a char primitive.

Parameters:
ch - the Character object whose value is returned.
Returns:
the primitive char value of the object.

unbox

public static byte unbox(java.lang.Byte b)
Returns the value of the specified Byte as a byte.

Parameters:
b - Byte that is unboxed
Returns:
the byte value represented by the Byte.

unbox

public static short unbox(java.lang.Short s)
Returns the short value represented by Short.

Parameters:
s - Short that is unboxed.
Returns:
the short value represented by the Short.

unbox

public static int unbox(java.lang.Integer i)
Returns the value of represented by Integer.

Parameters:
i - Integer that is unboxed.
Returns:
the int value represented by the Integer.

unbox

public static long unbox(java.lang.Long l)
Returns the long value represented by the specified Long.

Parameters:
l - Long to be unboxed.
Returns:
the long value represented by the Long.

unbox

public static float unbox(java.lang.Float f)
Returns the float value represented by the specified Float.

Parameters:
f - Float to be unboxed.
Returns:
the float value represented by the Float.

unbox

public static double unbox(java.lang.Double d)
Returns the double value represented by the specified Double.

Parameters:
d - Double to be unboxed.

str

public static java.lang.String str(boolean b)
Returns a String object representing the specified boolean. If the specified boolean is true, then the string "true" will be returned, otherwise the string "false" will be returned.

Parameters:
b - the boolean to be converted
Returns:
the string representation of the specified boolean

str

public static java.lang.String str(char c)
Returns a String object representing the specified char. The result is a string of length 1 consisting solely of the specified char.

Parameters:
c - the char to be converted
Returns:
the string representation of the specified char

str

public static java.lang.String str(int i)
Returns a String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string.

Parameters:
i - an integer to be converted.
Returns:
a string representation of the argument in base 10.

toHexString

public static java.lang.String toHexString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 16.

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 0s. 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:

 0123456789abcdef
 
These are the characters '\u0030' through '\u0039' and '\u0061' through '\u0066'.

Parameters:
i - an integer to be converted to a string.
Returns:
the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16).

str

public static java.lang.String str(long l)
Returns a String object representing the specified long. The argument is converted to signed decimal representation and returned as a string.

Parameters:
l - a long to be converted.
Returns:
a string representation of the argument in base 10.

toHexString

public static java.lang.String toHexString(long l)
Returns a string representation of the 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 0s. 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:

 0123456789abcdef
 
These are the characters '\u0030' through '\u0039' and '\u0061' through '\u0066'.

Parameters:
l - a long to be converted to a string.
Returns:
the string representation of the unsigned long value represented by the argument in hexadecimal (base 16).

str

public static java.lang.String str(float f)
Returns a string representation of the float argument. All characters mentioned below are ASCII characters. How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type 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.

Parameters:
f - the float to be converted.
Returns:
a string representation of the argument.

str

public static java.lang.String str(double d)
Returns a string representation of the double argument. All characters mentioned below are ASCII characters. How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type 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.

Parameters:
d - the double to be converted.
Returns:
a string representation of the argument.

exit

public static void exit(int exitCode)
Exits the BTrace session -- note that the particular client's tracing session exits and not the observed/traced program! After exit call, the trace action method terminates immediately and no other probe action method (of that client) will be called after that.

Parameters:
exitCode - exit value sent to the client

exit

public static void exit()
This is same as exit(int) except that the exit code is zero.

See Also:
exit(int)

perfInt

public static long perfInt(java.lang.String name)
accessing jvmstat (perf) int counter


perfLong

public static long perfLong(java.lang.String name)
accessing jvmstat (perf) long counter


perfString

public static java.lang.String perfString(java.lang.String name)
accessing jvmstat (perf) String counter


newHashMap

public static <K,V> java.util.Map<K,V> newHashMap()
Operating on maps


newWeakMap

public static <K,V> java.util.Map<K,V> newWeakMap()

newDeque

public static <V> java.util.Deque<V> newDeque()

get

public static <K,V> V get(java.util.Map<K,V> map,
                          java.lang.Object key)

containsKey

public static <K,V> boolean containsKey(java.util.Map<K,V> map,
                                        java.lang.Object key)

containsValue

public static <K,V> boolean containsValue(java.util.Map<K,V> map,
                                          java.lang.Object value)

put

public static <K,V> V put(java.util.Map<K,V> map,
                          K key,
                          V value)

remove

public static <K,V> V remove(java.util.Map<K,V> map,
                             java.lang.Object key)

clear

public static <K,V> void clear(java.util.Map<K,V> map)

size

public static <K,V> int size(java.util.Map<K,V> map)

isEmpty

public static <K,V> boolean isEmpty(java.util.Map<K,V> map)

size

public static <E> int size(java.util.Collection<E> coll)

isEmpty

public static <E> boolean isEmpty(java.util.Collection<E> coll)

contains

public static <E> boolean contains(java.util.Collection<E> coll,
                                   java.lang.Object obj)

contains

public static boolean contains(java.lang.Object[] array,
                               java.lang.Object value)

push

public static <V> void push(java.util.Deque<V> queue,
                            V value)

poll

public static <V> V poll(java.util.Deque<V> queue)

peek

public static <V> V peek(java.util.Deque<V> queue)

addLast

public static <V> void addLast(java.util.Deque<V> queue,
                               V value)

peekFirst

public static <V> V peekFirst(java.util.Deque<V> queue)

peekLast

public static <V> V peekLast(java.util.Deque<V> queue)

removeLast

public static <V> V removeLast(java.util.Deque<V> queue)

removeFirst

public static <V> V removeFirst(java.util.Deque<V> queue)

$

public static java.lang.String $(int n)
Returns n'th command line argument. null if not available.

Parameters:
n - command line argument index
Returns:
n'th command line argument

getpid

public static int getpid()
Returns the process id of the currently BTrace'd process.


$length

public static int $length()
Returns the number of command line arguments.


newAtomicInteger

public static java.util.concurrent.atomic.AtomicInteger newAtomicInteger(int initialValue)
Creates a new AtomicInteger with the given initial value.

Parameters:
initialValue - the initial value

get

public static int get(java.util.concurrent.atomic.AtomicInteger ai)
Gets the current value of the given AtomicInteger.

Parameters:
ai - AtomicInteger whose value is returned.
Returns:
the current value

set

public static void set(java.util.concurrent.atomic.AtomicInteger ai,
                       int newValue)
Sets to the given value to the given AtomicInteger.

Parameters:
ai - AtomicInteger whose value is set.
newValue - the new value

lazySet

public static void lazySet(java.util.concurrent.atomic.AtomicInteger ai,
                           int newValue)
Eventually sets to the given value to the given AtomicInteger.

Parameters:
ai - AtomicInteger whose value is lazily set.
newValue - the new value

compareAndSet

public 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.

Parameters:
ai - AtomicInteger whose value is compared and set.
expect - the expected value
update - the new value
Returns:
true if successful. False return indicates that the actual value was not equal to the expected value.

weakCompareAndSet

public 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.

May fail spuriously and does not provide ordering guarantees, so is only rarely an appropriate alternative to compareAndSet.

Parameters:
ai - AtomicInteger whose value is weakly compared and set.
expect - the expected value
update - the new value
Returns:
true if successful.

getAndIncrement

public static int getAndIncrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.

Parameters:
ai - AtomicInteger that is incremented.
Returns:
the previous value

getAndDecrement

public static int getAndDecrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.

Parameters:
ai - AtomicInteger that is decremented.
Returns:
the previous value

incrementAndGet

public static int incrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.

Parameters:
ai - AtomicInteger that is incremented.
Returns:
the updated value

decrementAndGet

public static int decrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.

Parameters:
ai - AtomicInteger whose value is decremented.
Returns:
the updated value

getAndAdd

public static int getAndAdd(java.util.concurrent.atomic.AtomicInteger ai,
                            int delta)
Atomically adds the given value to the current value.

Parameters:
ai - AtomicInteger whose value is added to.
delta - the value to add
Returns:
the previous value

addAndGet

public static int addAndGet(java.util.concurrent.atomic.AtomicInteger ai,
                            int delta)
Atomically adds the given value to the current value.

Parameters:
ai - AtomicInteger whose value is added to.
delta - the value to add
Returns:
the updated value

getAndSet

public static int getAndSet(java.util.concurrent.atomic.AtomicInteger ai,
                            int newValue)
Atomically sets to the given value and returns the old value.

Parameters:
ai - AtomicInteger whose value is set.
newValue - the new value
Returns:
the previous value

newAtomicLong

public static java.util.concurrent.atomic.AtomicLong newAtomicLong(long initialValue)
Creates a new AtomicLong with the given initial value.

Parameters:
initialValue - the initial value

get

public static long get(java.util.concurrent.atomic.AtomicLong al)
Gets the current value the given AtomicLong.

Parameters:
al - AtomicLong whose value is returned.
Returns:
the current value

set

public static void set(java.util.concurrent.atomic.AtomicLong al,
                       long newValue)
Sets to the given value.

Parameters:
al - AtomicLong whose value is set.
newValue - the new value

lazySet

public static void lazySet(java.util.concurrent.atomic.AtomicLong al,
                           long newValue)
Eventually sets to the given value to the given AtomicLong.

Parameters:
al - AtomicLong whose value is set.
newValue - the new value

compareAndSet

public 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.

Parameters:
al - AtomicLong whose value is compared and set.
expect - the expected value
update - the new value
Returns:
true if successful. False return indicates that the actual value was not equal to the expected value.

weakCompareAndSet

public 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.

May fail spuriously and does not provide ordering guarantees, so is only rarely an appropriate alternative to compareAndSet.

Parameters:
al - AtomicLong whose value is compared and set.
expect - the expected value
update - the new value
Returns:
true if successful.

getAndIncrement

public static long getAndIncrement(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.

Parameters:
al - AtomicLong whose value is incremented.
Returns:
the previous value

getAndDecrement

public static long getAndDecrement(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.

Parameters:
al - AtomicLong whose value is decremented.
Returns:
the previous value

incrementAndGet

public static long incrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.

Parameters:
al - AtomicLong whose value is incremented.
Returns:
the updated value

decrementAndGet

public static long decrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.

Parameters:
al - AtomicLong whose value is decremented.
Returns:
the updated value

getAndAdd

public static long getAndAdd(java.util.concurrent.atomic.AtomicLong al,
                             long delta)
Atomically adds the given value to the current value.

Parameters:
al - AtomicLong whose value is added to.
delta - the value to add
Returns:
the previous value

addAndGet

public static long addAndGet(java.util.concurrent.atomic.AtomicLong al,
                             long delta)
Atomically adds the given value to the current value.

Parameters:
al - AtomicLong whose value is added to
delta - the value to add
Returns:
the updated value

getAndSet

public static long getAndSet(java.util.concurrent.atomic.AtomicLong al,
                             long newValue)
Atomically sets to the given value and returns the old value.

Parameters:
al - AtomicLong that is set.
newValue - the new value
Returns:
the previous value

dtraceProbe

public static int dtraceProbe(java.lang.String str1,
                              java.lang.String str2)
BTrace to DTrace communication chennal. Raise DTrace USDT probe from BTrace.

See Also:
dtraceProbe(String,String,int,int)

dtraceProbe

public static int dtraceProbe(java.lang.String str1,
                              java.lang.String str2,
                              int i1)
BTrace to DTrace communication chennal. Raise DTrace USDT probe from BTrace.

See Also:
dtraceProbe(String,String,int,int)

dtraceProbe

public static int dtraceProbe(java.lang.String str1,
                              java.lang.String str2,
                              int i1,
                              int i2)
BTrace to DTrace communication channel. Raise DTrace USDT probe from BTrace.

Parameters:
str1 - first String param to DTrace probe
str2 - second String param to DTrace probe
i1 - first int param to DTrace probe
i2 - second int param to DTrace probe

property

public static java.lang.String property(java.lang.String key)
Gets the system property indicated by the specified key.

Parameters:
key - the name of the system property.
Returns:
the string value of the system property, or null if there is no property with that key.
Throws:
java.lang.NullPointerException - if key is null.
java.lang.IllegalArgumentException - if key is empty.

properties

public static java.util.Properties properties()
Returns all Sys properties.

Returns:
the system properties

printProperties

public static void printProperties()
Prints all Sys properties.


getenv

public static java.lang.String getenv(java.lang.String name)
Gets the value of the specified environment variable. An environment variable is a system-dependent external named value.

Parameters:
name - the name of the environment variable
Returns:
the string value of the variable, or null if the variable is not defined in the system environment
Throws:
java.lang.NullPointerException - if name is null

getenv

public static java.util.Map<java.lang.String,java.lang.String> getenv()
Returns an unmodifiable string map view of the current system environment. The environment is a system-dependent mapping from names to values which is passed from parent to child processes.

Returns:
the environment as a map of variable names to values

printEnv

public static void printEnv()
Prints all system environment values.


availableProcessors

public static long availableProcessors()
Returns the number of processors available to the Java virtual machine.

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.

Returns:
the maximum number of processors available to the virtual machine; never smaller than one

freeMemory

public static long freeMemory()
Returns the amount of free memory in the Java Virtual Machine. Calling the gc method may result in increasing the value returned by freeMemory.

Returns:
an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.

totalMemory

public static long totalMemory()
Returns the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment.

Note that the amount of memory required to hold an object of any given type may be implementation-dependent.

Returns:
the total amount of memory currently available for current and future objects, measured in bytes.

maxMemory

public static long maxMemory()
Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.

Returns:
the maximum amount of memory that the virtual machine will attempt to use, measured in bytes

heapUsage

public static java.lang.management.MemoryUsage heapUsage()
Returns heap memory usage


nonHeapUsage

public static java.lang.management.MemoryUsage nonHeapUsage()
Returns non-heap memory usage


init

public 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.


committed

public 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. This amount of memory is guaranteed for the Java virtual machine to use.


max

public static long max(java.lang.management.MemoryUsage mu)
Returns the maximum amount of memory in bytes that can be used for memory management. This method returns -1 if the maximum memory size is undefined.


used

public static long used(java.lang.management.MemoryUsage mu)
Returns the amount of used memory in bytes.


finalizationCount

public static long finalizationCount()
Returns the approximate number of objects for which finalization is pending.


vmArguments

public 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. This method returns an empty list if there is no input argument to the Java virtual machine.

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.

Returns:
a list of String objects; each element is an argument passed to the Java virtual machine.

printVmArguments

public static void printVmArguments()
Prints VM input arguments list.

See Also:
vmArguments()

vmVersion

public static java.lang.String vmVersion()
Returns the Java virtual machine implementation version. This method is equivalent to Sys.getProperty("java.vm.version").

Returns:
the Java virtual machine implementation version.

isBootClassPathSupported

public 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.

Returns:
true if the Java virtual machine supports the class path mechanism; false otherwise.

bootClassPath

public static java.lang.String bootClassPath()
Returns the boot class path that is used by the bootstrap class loader to search for class files.

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.

Returns:
the boot class path.
Throws:
java.lang.UnsupportedOperationException - if the Java virtual machine does not support this operation.

classPath

public static java.lang.String classPath()
Returns the Java class path that is used by the system class loader to search for class files. This method is equivalent to Sys.getProperty("java.class.path").

Returns:
the Java class path.

libraryPath

public static java.lang.String libraryPath()
Returns the Java library path. This method is equivalent to Sys.getProperty("java.library.path").

Multiple paths in the Java library path are separated by the path separator character of the platform of the Java virtual machine being monitored.

Returns:
the Java library path.

threadCount

public static long threadCount()
Returns the current number of live threads including both daemon and non-daemon threads.

Returns:
the current number of live threads.

peakThreadCount

public static long peakThreadCount()
Returns the peak live thread count since the Java virtual machine started or peak was reset.

Returns:
the peak live thread count.

totalStartedThreadCount

public static long totalStartedThreadCount()
Returns the total number of threads created and also started since the Java virtual machine started.

Returns:
the total number of threads started.

daemonThreadCount

public static long daemonThreadCount()
Returns the current number of live daemon threads.

Returns:
the current number of live daemon threads.

currentThreadCpuTime

public static long currentThreadCpuTime()
Returns the total CPU time for the current thread in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the current thread has executed in user mode or system mode.


currentThreadUserTime

public static long currentThreadUserTime()
Returns the CPU time that the current thread has executed in user mode in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy.


getTotalGcTime

public static long getTotalGcTime()
Returns the total amount of time spent in GarbageCollection up to this point since the application was started.

Returns:
Returns the amount of overall time spent in GC

sizeof

public static long sizeof(java.lang.Object objectToSize)
Returns an implementation-specific approximation of the amount of storage consumed by the specified object. The result may include some or all of the object's overhead, and thus is useful for comparison within an implementation but not between implementations. The estimate may change during a single invocation of the JVM.

Parameters:
objectToSize - the object to size
Returns:
an implementation-specific approximation of the amount of storage consumed by the specified object
Throws:
java.lang.NullPointerException - if the supplied Object is null.

dumpHeap

public static void dumpHeap(java.lang.String fileName)
Dump the snapshot of the Java heap to a file in hprof binary format. Only the live objects are dumped. Under the current dir of traced app, ./btrace<pid>/<btrace-class>/ directory is created. Under that directory, a file of given fileName is created.

Parameters:
fileName - name of the file to which heap is dumped

dumpHeap

public static void dumpHeap(java.lang.String fileName,
                            boolean live)
Dump the snapshot of the Java heap to a file in hprof binary format. Under the current dir of traced app, ./btrace<pid>/<btrace-class>/ directory is created. Under that directory, a file of given fileName is created.

Parameters:
fileName - name of the file to which heap is dumped
live - flag that tells whether only live objects are to be dumped or all objects are to be dumped.

gc

public static void gc()
Runs the garbage collector.

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.


runFinalization

public static void runFinalization()
Runs the finalization methods of any objects pending finalization.

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.


serialize

public static void serialize(java.io.Serializable obj,
                             java.lang.String fileName)
Serialize a given object into the given file. Under the current dir of traced app, ./btrace<pid>/<btrace-class>/ directory is created. Under that directory, a file of given fileName is created.

Parameters:
obj - object that has to be serialized.
fileName - name of the file to which the object is serialized.

toXML

public 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.


writeXML

public 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. Under the current dir of traced app, ./btrace<pid>/<btrace-class>/ directory is created. Under that directory, a file of the given fileName is created.


writeDOT

public 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, ./btrace<pid>/<btrace-class>/ directory is created. Under that directory, a file of the given fileName is created.

Since:
1.1

speculation

public static int speculation()
Returns an identifier for a new speculative buffer.

Returns:
new speculative buffer id

speculate

public static void speculate(int id)
Sets current speculative buffer id.

Parameters:
id - the speculative buffer id

commit

public static void commit(int id)
Commits the speculative buffer associated with id.

Parameters:
id - the speculative buffer id

discard

public static void discard(int id)
Discards the speculative buffer associated with id.

Parameters:
id - the speculative buffer id

newAggregation

public static Aggregation newAggregation(AggregationFunction type)
Creates a new aggregation based on the given aggregation function type.

Parameters:
type - the aggregating function to be performed on the data being added to the aggregation.

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1)
Creates a grouping aggregation key with the provided value. The value must be a String or Number type.

Parameters:
element1 - the value of the aggregation key

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1,
                                               java.lang.Object element2)
Creates a composite grouping aggregation key with the provided values. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key

newAggregationKey

public 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. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key
element3 - the third element of the composite aggregation key

newAggregationKey

public 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. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key
element3 - the third element of the composite aggregation key
element4 - the fourth element of the composite aggregation key

addToAggregation

public static void addToAggregation(Aggregation aggregation,
                                    long value)
Adds a value to the aggregation with no grouping key. This method should be used when the aggregation is to calculate only a single aggregated value.

Parameters:
aggregation - the aggregation to which the value should be added

addToAggregation

public static void addToAggregation(Aggregation aggregation,
                                    AggregationKey key,
                                    long value)
Adds a value to the aggregation with a grouping key. This method should be used when the aggregation should effectively perform a "group by" on the key value. The aggregation will calculate a separate aggregated value for each unique aggregation key.

Parameters:
aggregation - the aggregation to which the value should be added
key - the grouping aggregation key

clearAggregation

public static void clearAggregation(Aggregation aggregation)
Resets values within the aggregation to the default. This will affect all values within the aggregation when multiple aggregation keys have been used.

Parameters:
aggregation - the aggregation to be cleared

truncateAggregation

public static void truncateAggregation(Aggregation aggregation,
                                       int count)
Removes all aggregated values from the aggregation except for the largest or smallest 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.

Parameters:
aggregation - the aggregation to be truncated
count - the number of elements to preserve. If negative, the smallest abs(count) elements are preserved.

printAggregation

public static void printAggregation(java.lang.String name,
                                    Aggregation aggregation)
Prints the aggregation.


printAggregation

public static void printAggregation(java.lang.String name,
                                    Aggregation aggregation,
                                    java.lang.String format)
Prints aggregation using the provided format

Parameters:
name - The name of the aggregation to be used in the textual output
aggregation - The aggregation to print
format - 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 item
Since:
1.1
See Also:
String.format(java.lang.String, java.lang.Object[])