Extension SDK 10.1.2

oracle.ide.util
Class IdeProfile

java.lang.Object
  extended byoracle.ide.util.IdeProfile

public final class IdeProfile
extends java.lang.Object

This class wraps the OJVM Event Profiler.

The reason for not using the ProfilerAPI directly is basically that oracle.ide cannot depend on oracle.jdeveloper.

The following code is an example on how to instrument your code: Example:

 {
   int handle = IdeProfile.startEvent(handle, IdeProfile.PROF_XXX, "Hello");
   ...
   IdeProfile.endEvent(handle);
 }
 

If your String comment is constructed (ex: this.toString()) it is preferable to check the isActive() method to determine if it is necessary to call the IdeProfile.startEvent(toString())

There is a better way to instrument the code using the void startEvent(int[], ...) methods. This call is equivalent to int startEvent(int, String) except that the call can be totally excluded from the class file using the -exclude compiler parameter and the allocated event[] is will be removed by the optimizer.

In conclusion, the purest way to instrument your code would be:
 {
   int[] handle = new int[1];
   if (IdeProfile.isActive())
   {
     IdeProfile.startEvent(handle, IdeProfile.PROF_XXX, "Hello");
   }
   ...
   IdeProfile.endEvent(handle);
 }
 


Field Summary
static int PROF_CMT_FIRST
           
static int PROF_CMT_LAST
           
static int PROF_DEBUGGER_FIRST
           
static int PROF_DEBUGGER_LAST
           
static int PROF_DOCK_LAYOUT
          Measure the time needed to re-layout the docked windows
static int PROF_EJB_FIRST
           
static int PROF_EJB_LAST
           
static int PROF_FIRST
           
static int PROF_GENERIC
          Deprecated. because you are not supposed to checkin code with this ID.
static int PROF_IDE_FIRST
           
static int PROF_IDE_LAST
           
static int PROF_IDEIMPL_FIRST
           
static int PROF_IDEIMPL_LAST
           
static int PROF_INIT_ADDINS
          Measures the initialization of the addins
static int PROF_JDEVELOPER_FIRST
           
static int PROF_JDEVELOPER_LAST
           
static int PROF_JDEVIMPL_FIRST
           
static int PROF_JDEVIMPL_LAST
           
static int PROF_JOT_FIRST
           
static int PROF_JOT_LAST
           
static int PROF_KEYPRESSED
          Pulse an event every time a key is pressed.
static int PROF_LOAD_ADDINS
          Measures the load of the addins
static int PROF_NOTIFY_OBSERVERS
          Event for calls to IdeSubject.notifyObserver
static int PROF_STARTUP
          Measures the startup of the IDE
 
Constructor Summary
IdeProfile()
           
 
Method Summary
static void endEvent(int handle)
          Stop a profiler event
static void endEvent(int[] handle)
          Stop a profiler event
static void endEvent(int[] handle, java.lang.String comment)
          Stop a profiler event
static void endEvent(int handle, java.lang.String comment)
          Stop a profiler event
static Profiler getCurrentIdeProfiler()
          Returns the profiler currently plugged for the IDE
static boolean isActive()
           
static boolean isEventActive(int eventID)
           
static void pulseEvent(int event, java.lang.String comment)
          Pulse a profiler event
static void setCurrentIdeProfiler(Profiler profiler)
          Plugs a new profiler.
static void setCurrentIdeProfiler(java.lang.String sProfilerClassName)
          Plugs a new profiler This method is called from Ide.startupImpl().
static int startEvent(int event)
          Starts a profiler event
static void startEvent(int[] handle, int event)
          Starts a profiler event
static void startEvent(int[] handle, int event, java.lang.String comment)
          Starts a profiler event
static int startEvent(int event, java.lang.String comment)
          Starts a profiler event
static void startSampling()
          Start profiler sampling
static void stopSampling()
          Stop profiler sampling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROF_FIRST

public static int PROF_FIRST

PROF_GENERIC

public static final int PROF_GENERIC
Deprecated. because you are not supposed to checkin code with this ID.

This event ID can be used for temporary instrumentation so that you do not have to modify IdeProfile to add another ID.


PROF_STARTUP

public static final int PROF_STARTUP
Measures the startup of the IDE


PROF_LOAD_ADDINS

public static final int PROF_LOAD_ADDINS
Measures the load of the addins


PROF_INIT_ADDINS

public static final int PROF_INIT_ADDINS
Measures the initialization of the addins


PROF_KEYPRESSED

public static final int PROF_KEYPRESSED
Pulse an event every time a key is pressed. This makes it easier to analyze the profiling session


PROF_DOCK_LAYOUT

public static final int PROF_DOCK_LAYOUT
Measure the time needed to re-layout the docked windows


PROF_NOTIFY_OBSERVERS

public static final int PROF_NOTIFY_OBSERVERS
Event for calls to IdeSubject.notifyObserver


PROF_JOT_FIRST

public static final int PROF_JOT_FIRST
See Also:
Constant Field Values

PROF_JOT_LAST

public static final int PROF_JOT_LAST
See Also:
Constant Field Values

PROF_CMT_FIRST

public static final int PROF_CMT_FIRST
See Also:
Constant Field Values

PROF_CMT_LAST

public static final int PROF_CMT_LAST
See Also:
Constant Field Values

PROF_IDE_FIRST

public static final int PROF_IDE_FIRST
See Also:
Constant Field Values

PROF_IDE_LAST

public static final int PROF_IDE_LAST
See Also:
Constant Field Values

PROF_IDEIMPL_FIRST

public static final int PROF_IDEIMPL_FIRST
See Also:
Constant Field Values

PROF_IDEIMPL_LAST

public static final int PROF_IDEIMPL_LAST
See Also:
Constant Field Values

PROF_JDEVELOPER_FIRST

public static final int PROF_JDEVELOPER_FIRST
See Also:
Constant Field Values

PROF_JDEVELOPER_LAST

public static final int PROF_JDEVELOPER_LAST
See Also:
Constant Field Values

PROF_JDEVIMPL_FIRST

public static final int PROF_JDEVIMPL_FIRST
See Also:
Constant Field Values

PROF_JDEVIMPL_LAST

public static final int PROF_JDEVIMPL_LAST
See Also:
Constant Field Values

PROF_EJB_FIRST

public static final int PROF_EJB_FIRST
See Also:
Constant Field Values

PROF_EJB_LAST

public static final int PROF_EJB_LAST
See Also:
Constant Field Values

PROF_DEBUGGER_FIRST

public static final int PROF_DEBUGGER_FIRST
See Also:
Constant Field Values

PROF_DEBUGGER_LAST

public static final int PROF_DEBUGGER_LAST
See Also:
Constant Field Values
Constructor Detail

IdeProfile

public IdeProfile()
Method Detail

getCurrentIdeProfiler

public static Profiler getCurrentIdeProfiler()
Returns the profiler currently plugged for the IDE


setCurrentIdeProfiler

public static void setCurrentIdeProfiler(Profiler profiler)
Plugs a new profiler. If the new profiler is inactive, it will not replace the current one so that we can skip one level of indirection.

Parameters:
profiler - the new profiler

setCurrentIdeProfiler

public static void setCurrentIdeProfiler(java.lang.String sProfilerClassName)
Plugs a new profiler This method is called from Ide.startupImpl().


isActive

public static boolean isActive()
Returns:
true if the profiler is active

isEventActive

public static boolean isEventActive(int eventID)
Returns:
true if the profiler is active and the given event is selected for profiling.

startEvent

public static int startEvent(int event,
                             java.lang.String comment)
Starts a profiler event

Parameters:
event - the event ID
comment - comments you want to see in the profile report
Returns:
the event handle to be used in the endEvent call

startEvent

public static int startEvent(int event)
Starts a profiler event

Parameters:
event - the event ID
Returns:
the event handle to be used in the endEvent call

startEvent

public static void startEvent(int[] handle,
                              int event,
                              java.lang.String comment)
Starts a profiler event

Parameters:
handle - the event handle to be used in the endEvent call
event - the event ID
comment - comments you want to see in the profile report

startEvent

public static void startEvent(int[] handle,
                              int event)
Starts a profiler event

Parameters:
handle - the event handle to be used in the endEvent call
event - the event ID

endEvent

public static void endEvent(int handle,
                            java.lang.String comment)
Stop a profiler event

Parameters:
handle - the event handle returned by the startEvent call
comment - comments you want to see in the profile report

endEvent

public static void endEvent(int handle)
Stop a profiler event

Parameters:
handle - the event handle returned by the startEvent call

endEvent

public static void endEvent(int[] handle,
                            java.lang.String comment)
Stop a profiler event

Parameters:
handle - the event handle returned by the startEvent call
comment - comments you want to see in the profile report

endEvent

public static void endEvent(int[] handle)
Stop a profiler event

Parameters:
handle - the event handle returned by the startEvent call

pulseEvent

public static void pulseEvent(int event,
                              java.lang.String comment)
Pulse a profiler event

Parameters:
event - the event ID
comment - comments you want to see in the profile report

startSampling

public static void startSampling()
Start profiler sampling


stopSampling

public static void stopSampling()
Stop profiler sampling


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.