public final class Trace
extends java.lang.Object
Trace
class contains methods for controlling trace and using application trace.
This class cannot be instantiated.
The methods set(String cmd)
, suspend()
, resume()
, suspendThis()
, resumeThis()
and snap()
are used
to control trace by changing the current trace settings, suspending or resuming tracing globally or just for the current thread and by
triggering a snap dump of the current trace buffers.
The registerApplication(String name, String[] templates)
method allows a new trace component and trace points
to be registered with trace.
The trace(int handle, int traceId, ...)
methods are used take the application
trace points registered by registerApplication(name, formats)
. The handle
value is the integer returned by the registerApplication(name, formats)
.
The traceId is an index into the formats array and the trace(int handle, int traceId, ...)
method called must match the types required by the format String formats[traceId]
.
If the number or types of the parameters passed to trace(int handle, int traceId, ...)
do not match the arguments in formats[traceId]
a java/lang/IllegalArgumentException
will be thrown.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ENTRY |
static java.lang.String |
EVENT |
static java.lang.String |
EXCEPTION |
static java.lang.String |
EXCEPTION_EXIT |
static java.lang.String |
EXIT |
Modifier and Type | Method and Description |
---|---|
static long |
getMicros()
Deprecated.
Use
System.nanoTime() instead as this provides as
good or better resolution and is more portable. |
static void |
initializeTrace()
Deprecated.
this method does nothing
|
static int |
registerApplication(java.lang.String name,
java.lang.String[] templates)
Registers a new application and trace points for that application with
trace.
|
static void |
resume()
Resumes tracing for all the threads in the JVM.
|
static void |
resumeThis()
Increments the suspend and resume count for the current thread and resumes
tracing the thread if the result is not negative.
|
static int |
set(java.lang.String cmd)
Sets options for the trace subsystem.
|
static void |
snap()
Trigger a snap dump.
|
static void |
suspend()
Suspends tracing for all the threads in the JVM.
|
static void |
suspendThis()
Decrements the suspend and resume count for the current thread and suspends
tracing the thread if the result is negative.
|
static void |
trace(int handle,
int traceId) |
static void |
trace(int handle,
int traceId,
byte b1) |
static void |
trace(int handle,
int traceId,
byte b1,
byte b2) |
static void |
trace(int handle,
int traceId,
byte b1,
byte b2,
byte b3) |
static void |
trace(int handle,
int traceId,
byte b1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
byte b1,
java.lang.String s1,
byte b2) |
static void |
trace(int handle,
int traceId,
char c1) |
static void |
trace(int handle,
int traceId,
char c1,
char c2) |
static void |
trace(int handle,
int traceId,
char c1,
char c2,
char c3) |
static void |
trace(int handle,
int traceId,
char c1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
char c1,
java.lang.String s1,
char c2) |
static void |
trace(int handle,
int traceId,
double d1) |
static void |
trace(int handle,
int traceId,
double d1,
double d2) |
static void |
trace(int handle,
int traceId,
double d1,
double d2,
double d3) |
static void |
trace(int handle,
int traceId,
double d1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
double d1,
java.lang.String s1,
double d2) |
static void |
trace(int handle,
int traceId,
float f1) |
static void |
trace(int handle,
int traceId,
float f1,
float f2) |
static void |
trace(int handle,
int traceId,
float f1,
float f2,
float f3) |
static void |
trace(int handle,
int traceId,
float f1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
float f1,
java.lang.String s1,
float f2) |
static void |
trace(int handle,
int traceId,
int i1) |
static void |
trace(int handle,
int traceId,
int i1,
int i2) |
static void |
trace(int handle,
int traceId,
int i1,
int i2,
int i3) |
static void |
trace(int handle,
int traceId,
int i1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
int i1,
java.lang.String s1,
int i2) |
static void |
trace(int handle,
int traceId,
long l1) |
static void |
trace(int handle,
int traceId,
long l1,
long l2) |
static void |
trace(int handle,
int traceId,
long l1,
long l2,
long i3) |
static void |
trace(int handle,
int traceId,
long l1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
long l1,
java.lang.String s1,
long l2) |
static void |
trace(int handle,
int traceId,
java.lang.Object o1) |
static void |
trace(int handle,
int traceId,
java.lang.Object o1,
java.lang.Object o2) |
static void |
trace(int handle,
int traceId,
java.lang.Object o1,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
java.lang.Object o1,
java.lang.String s1,
java.lang.Object o2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
byte b1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
byte b1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
char c1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
char c1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
double d1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
double d1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
float f1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
float f1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
int i1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
int i1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
long l1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
long l1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
java.lang.Object o1) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
java.lang.Object o1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
java.lang.String s2) |
static void |
trace(int handle,
int traceId,
java.lang.String s1,
java.lang.String s2,
java.lang.String s3) |
public static final java.lang.String EVENT
public static final java.lang.String EXCEPTION
public static final java.lang.String ENTRY
public static final java.lang.String EXIT
public static final java.lang.String EXCEPTION_EXIT
@Deprecated public static void initializeTrace()
public static int set(java.lang.String cmd)
The trace option is passed in as a String.
Use the same syntax as the -Xtrace command-line option, with the initial -Xtrace: omitted.
See Using the -Xtrace option as described in the section on trace options in the documentation for the IBM JVM. Note that some options can only be set at startup on the command line not at runtime using this method.
This method returns zero on success and non-zero otherwise.
A security manager check will be made only if the system property com.ibm.jvm.enableLegacyTraceSecurity is set to "true" in which case a check will be made for com.ibm.jvm.TracePermission
cmd
- the trace options string to setjava.lang.SecurityException
- if there is a security manager and it doesn't allow the
checks required to change the dump settingspublic static void snap()
java.lang.SecurityException
- if there is a security manager and it doesn't allow the checks required to take this dumppublic static void suspend()
java.lang.SecurityException
- if there is a security manager and it doesn't allow the checks required to take this dumppublic static void resume()
java.lang.SecurityException
- if there is a security manager and it doesn't allow the checks required to take this dumppublic static void suspendThis()
java.lang.SecurityException
- if there is a security manager and it doesn't allow the checks required to take this dumppublic static void resumeThis()
java.lang.SecurityException
- if there is a security manager and it doesn't allow the checks required to take this dumppublic static int registerApplication(java.lang.String name, java.lang.String[] templates)
The registerApplication() method returns an integer value. Use this value as the handle parameter in subsequent trace() calls. If the registerApplication() method call fails for any reason the value returned is -1.
When enabling or disabling trace points registered for this application
either on the command line or using Trace.set() the trace point id's will
be the application name and the index in the template array.
For example if you register an application called HelloWorld with three
Strings in the template array the trace id's will be HelloWorld.0,
HelloWorld.1 and HelloWorld.2
To start printing the third trace point you could call Trace.set() like
this: Trace.set("print=HelloWorld.2");
A security manager check will be made only if the system property com.ibm.jvm.enableLegacyTraceSecurity is set to "true" in which case a check will be made for com.ibm.jvm.TracePermission
name
- the name of the application you want to tracetemplates
- an array of format strings like the strings used by the C
printf methodjava.lang.SecurityException
- if there is a security manager and it doesn't allow the
checks required to take this dumppublic static void trace(int handle, int traceId)
public static void trace(int handle, int traceId, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, java.lang.String s2)
public static void trace(int handle, int traceId, java.lang.String s1, java.lang.String s2, java.lang.String s3)
public static void trace(int handle, int traceId, java.lang.String s1, java.lang.Object o1)
public static void trace(int handle, int traceId, java.lang.Object o1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, int i1)
public static void trace(int handle, int traceId, int i1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, long l1)
public static void trace(int handle, int traceId, long l1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, byte b1)
public static void trace(int handle, int traceId, byte b1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, char c1)
public static void trace(int handle, int traceId, char c1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, float f1)
public static void trace(int handle, int traceId, float f1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.String s1, double d1)
public static void trace(int handle, int traceId, double d1, java.lang.String s1)
public static void trace(int handle, int traceId, java.lang.Object o1)
public static void trace(int handle, int traceId, java.lang.Object o1, java.lang.Object o2)
public static void trace(int handle, int traceId, int i1)
public static void trace(int handle, int traceId, int i1, int i2)
public static void trace(int handle, int traceId, int i1, int i2, int i3)
public static void trace(int handle, int traceId, long l1)
public static void trace(int handle, int traceId, long l1, long l2)
public static void trace(int handle, int traceId, long l1, long l2, long i3)
public static void trace(int handle, int traceId, byte b1)
public static void trace(int handle, int traceId, byte b1, byte b2)
public static void trace(int handle, int traceId, byte b1, byte b2, byte b3)
public static void trace(int handle, int traceId, char c1)
public static void trace(int handle, int traceId, char c1, char c2)
public static void trace(int handle, int traceId, char c1, char c2, char c3)
public static void trace(int handle, int traceId, float f1)
public static void trace(int handle, int traceId, float f1, float f2)
public static void trace(int handle, int traceId, float f1, float f2, float f3)
public static void trace(int handle, int traceId, double d1)
public static void trace(int handle, int traceId, double d1, double d2)
public static void trace(int handle, int traceId, double d1, double d2, double d3)
public static void trace(int handle, int traceId, java.lang.String s1, java.lang.Object o1, java.lang.String s2)
public static void trace(int handle, int traceId, java.lang.Object o1, java.lang.String s1, java.lang.Object o2)
public static void trace(int handle, int traceId, java.lang.String s1, int i1, java.lang.String s2)
public static void trace(int handle, int traceId, int i1, java.lang.String s1, int i2)
public static void trace(int handle, int traceId, java.lang.String s1, long l1, java.lang.String s2)
public static void trace(int handle, int traceId, long l1, java.lang.String s1, long l2)
public static void trace(int handle, int traceId, java.lang.String s1, byte b1, java.lang.String s2)
public static void trace(int handle, int traceId, byte b1, java.lang.String s1, byte b2)
public static void trace(int handle, int traceId, java.lang.String s1, char c1, java.lang.String s2)
public static void trace(int handle, int traceId, char c1, java.lang.String s1, char c2)
public static void trace(int handle, int traceId, java.lang.String s1, float f1, java.lang.String s2)
public static void trace(int handle, int traceId, float f1, java.lang.String s1, float f2)
public static void trace(int handle, int traceId, java.lang.String s1, double d1, java.lang.String s2)
public static void trace(int handle, int traceId, double d1, java.lang.String s1, double d2)
@Deprecated public static long getMicros()
System.nanoTime()
instead as this provides as
good or better resolution and is more portable.Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1998, 2023 IBM Corp. and others.