This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 109072 - Need Netbeans Profiler Framework
Summary: Need Netbeans Profiler Framework
Status: NEW
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 3 votes (vote)
Assignee: issues@profiler
Depends on: 203519
Blocks: 118322
  Show dependency tree
Reported: 2007-07-07 18:00 UTC by rcauble
Modified: 2011-10-11 14:16 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description rcauble 2007-07-07 18:00:55 UTC
This request is for a Netbeans Profiler Framework (similar to the debugger framework). This RFE is limited in scope by 
the needs of our profiler, but should serve as a starting point.

As far as the "framework" portion, my preference would be to keep this to a minimum, only constraining the profiler
ui in those areas necessary. Basically there needs to be common global actions and a common "Profiler" control panel 

The following actions are used by our profiler:
-Profile Main Project
-Stop Profiler
-Reset Collected Results
-Take Snapshot
-Modify Profiling

For the purposes of illustration, I'll list a few hypothetical classes:

 * When performing a ProfileMainProject, a window with a selection box
 * will popup. The selection box will list all profiler types that
 * are valid for the main project. Similarly, when right-clicking on
 * a project->Profile Project, the same dialog will popup. This dialog
 * is driven off the set of registered ProfilerTypes.
 * (This is all very similar to the way the debugger framework does it
 *  - see "org.netbeans.spi.debugger.ui.AttachType")
public interface ProfilerType
    * Name to display in list
   String getDisplayName();

    * If it returns true, this will be listed.
   boolean isProjectSupported(Project project);

    * Gets the component to display in the main area of the 
    * "Start Profiler" dialog in when this ProfilerType is selected. 
    * This JComponent is expected to implement "Controller".
   JComponent getStartOptionsComponent(Project project);

 * To be implemented by the getStartOptionsComponent returned by ProfilerType.
 * Modelled the same way as org.netbeans.spi.debugger.ui.AttachType.
 * NOTE: I am using "isInputValid" rather than "isValid" to avoid
 * method name collision with java.awt.Component.isValid.
public interface Controller
    static final String PROP_VALID = "valid";
    void addPropertyChangeListener(PropertyChangeListener l) ;
    boolean cancel() 
    boolean isInputValid() 
    boolean ok() 
    void removePropertyChangeListener(PropertyChangeListener l) 

 * Registry of profiler sessions. The main thing here is the notion of a "current session"
 * since that is the session that all of the global actions "stop profiler",
 * "reset collected results", "take snapshot" delegate to. Also, the current session
 * is the one which the "Profiler" top level component displays. (See ProfilerSession.getProfilerControlPanel).
public class ProfilerSessionRegistry
   static final String PROP_CURRENT_SESSION = "currentSession";
   static final String PROP_SESSIONS        = "sessions";

   void addPropertyChangeListener(PropertyChangeListener l) ;
   void removePropertyChangeListener(PropertyChangeListener l) 

   public void removeSession(ProfilerSession session);
   public void addSession(ProfilerSession session);

   public void setCurrentSession(ProfilerSession session);
   public ProfilerSession getCurrentSession();

   public static ProfilerSessionRegistry getDefault();

 * A running instance of a profiler. 
public interface ProfilerSession
    * The profiler type associated with this session.
   public ProfilerType getProfilerType();

    * The component to display in the "Profiler" top level component when this is the current session.
   public JComponent getProfilerControlPanel();

   void addPropertyChangeListener(PropertyChangeListener l) ;
   void removePropertyChangeListener(PropertyChangeListener l) 
   // Action handlers for various global actions

   static final String PROP_STOP_ENABLED = "stopEnabled";
   public boolean isStopEnabled();
   public void stop();

   static final String PROP_RESET_ENABLED = "resetCollectedResultsEnabled";
   public boolean isResetCollectedResultsEnabled();
   public void resetCollectedResults();

   static final String PROP_SNAPSHOT_ENABLED = "snapshotEnabled";
   public boolean isTakeSnapshotEnabled();
   public void takeSnapshot();

   static final String PROP_MODIFY_PROFILING_ENABLED = "modifyProfilingEnabled";
   public boolean isModifyProfilingEnabled();
   public void modifyProfiling();


Common Utilities
Here's a list of common utilities that would be nice if they were

1)First and foremost, the treetable component used by the call tree view, etc.
This feels like a general-purpose netbeans utility rather than something
specific to the profiler. 

In our profiler, we ended up using the org.netbeans.spi.viewmodel.Models stuff
from the netbeans debugger. This works well, but has a couple of 
a)It doesn't expose any way to iterate over the tree in its currently sorted
order, so Find Next and Find Previous do not find items in the order that
it is currently displayed in. (See defect 104029).

b)It doesn't give control over the display components used in the treetable,
so we can't put graphs in there or do the even-odd row shading that is present
in the Netbeans Profiler.

2)There are a number of classes used to construct the ProfilerControlPanel, that
would be nice if they were public utilities: