You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(73) |
Sep
(92) |
Oct
(9) |
Nov
(80) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(92) |
Feb
(52) |
Mar
(71) |
Apr
(64) |
May
(53) |
Jun
(10) |
Jul
(111) |
Aug
(93) |
Sep
(134) |
Oct
|
Nov
|
Dec
|
From: Pavel V. <va...@us...> - 2002-07-22 17:51:33
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv6334 Modified Files: VirtualMachineImpl.java Log Message: realtime via getRealtimeImage() method, it no longer implements VirtualMachineImageRef Index: VirtualMachineImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/VirtualMachineImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** VirtualMachineImpl.java 22 Jul 2002 00:17:29 -0000 1.9 --- VirtualMachineImpl.java 22 Jul 2002 17:51:30 -0000 1.10 *************** *** 39,43 **** private Process process=null; ! private VirtualMachineImageRef realtime=null; /** --- 39,43 ---- private Process process=null; ! private VirtualMachineImageRef realtime=null; /** *************** *** 80,83 **** --- 80,84 ---- } catch (UNAVAILABLE_Exception e) { //PENDING + throw new RuntimeException("TODO: handle this: \"Enabling of Garbage Collection is unavailable\"" + e.getMessage()); } } *************** *** 95,106 **** /** ! * Creates the snapshot of the current profiling information about the mirrored * virtual machine. */ public Snapshot createSnapshot() { ! //pending: to pass configuration ! //pending: if not_suspendedVM then suspendVM and resumeVM suspendThreads(); - //FIXME SnapshotImpl snap = new SnapshotImpl( iprof ); resumeThreads(); --- 96,106 ---- /** ! * Creates the snapshot of the current profiling information in the * virtual machine. */ public Snapshot createSnapshot() { ! //PENDING: to pass configuration ! //PENDING: if not_suspendedVM then suspendVM and resumeVM suspendThreads(); SnapshotImpl snap = new SnapshotImpl( iprof ); resumeThreads(); *************** *** 108,111 **** --- 108,115 ---- } + /** + * Creates the snapshot of the current profiling information in the + * virtual machine. + */ public Snapshot createSnapshot(Snapshot.Configuration conf) { //PENDING: TO PASS CONFIGURATION *************** *** 125,129 **** */ public void exit(int exitCode) { - //PENDING try { iprof.exitVM(); --- 129,132 ---- *************** *** 146,154 **** /** ! * Suspends all threads in the virtual machine as described in ! * {@link ThreadInfo#suspend()}. */ public void suspendThreads() { ! //PENDING try { iprof.suspendVM(); --- 149,156 ---- /** ! * Suspends all threads in the virtual machine. */ public void suspendThreads() { ! //PENDING detect handle if the machine is suspended try { iprof.suspendVM(); *************** *** 157,160 **** --- 159,163 ---- } catch (UNAVAILABLE_Exception e) { //PENDING + throw new RuntimeException("TODO: handle this: \"Suspend Threads is unavailable\"" + e.getMessage()); } } *************** *** 176,184 **** /** ! * Resumes all threads in the virtual machine as described in ! * {@link ThreadInfo#resume()}. */ public void resumeThreads() { ! //PENDING try { iprof.resumeVM(); --- 179,186 ---- /** ! * Resumes all threads in the virtual machine. */ public void resumeThreads() { ! //PENDING try { iprof.resumeVM(); *************** *** 187,190 **** --- 189,193 ---- } catch (UNAVAILABLE_Exception e) { //PENDING + throw new RuntimeException("TODO: handle this: \" Resume Threads is unavailable\"" + e.getMessage()); } } *************** *** 210,213 **** --- 213,217 ---- } catch (UNAVAILABLE_Exception e) { //PENDING + throw new RuntimeException("TODO: handle this: \" Garbage Collection is unavailable\"" + e.getMessage() ); } } *************** *** 254,313 **** } ! //FIXME ! /**Returns realtime image of library. After that you can access information in library ! * withtout creating snapshot. For one instace of VirtalMachineImpl it returns the same object. ! */ ! public VirtualMachineImageRef getRealtimeImage() { ! return realtime; ! } ! ! public List getThreads() { ! return realtime.getThreads(); ! } ! ! public List getMethods() { ! return realtime.getMethods(); ! } ! ! public List getCPUTraces() { ! return realtime.getCPUTraces(); ! } ! ! public List getAllocTraces() { ! return realtime.getAllocTraces(); ! } ! ! public List getMonTraces() { ! return realtime.getMonTraces(); ! } ! ! public List getTypes() { ! return realtime.getTypes(); ! } ! ! public List getThreadGroups() { ! return realtime.getThreadGroups(); ! } ! ! public List getClasses() { ! return realtime.getClasses(); ! } ! ! public List getGCRuns() { ! return realtime.getGCRuns(); } - public void addChildrenListener( int type, ChildrenListener listener) { - realtime.addChildrenListener( type, listener ); - } - - public void removeChildrenListener( int type, ChildrenListener listener) { - realtime.removeChildrenListener( type, listener ); - } - } /* * $Log$ * Revision 1.9 2002/07/22 00:17:29 vachis * add implementation of realtime interface (fasade) --- 258,275 ---- } ! /**Returns realtime image of library. After that you can access information in library realtime ! * without creating snapshot. For one instace of VirtalMachineImpl it returns always the same refenrece. ! */ ! public VirtualMachineImageRef getRealtimeImage() { ! return realtime; } } /* * $Log$ + * Revision 1.10 2002/07/22 17:51:30 vachis + * realtime via getRealtimeImage() method, it no longer implements VirtualMachineImageRef + * * Revision 1.9 2002/07/22 00:17:29 vachis * add implementation of realtime interface (fasade) |
From: Pavel V. <va...@us...> - 2002-07-22 17:50:05
|
Update of /cvsroot/javaprofiler/jpi/net/sourceforge/javaprofiler/jpi In directory usw-pr-cvs1:/tmp/cvs-serv5782 Modified Files: VirtualMachineRef.java Log Message: realtime via getRealtimeImage() method, it no longer extends VirtualMachineImageRef Index: VirtualMachineRef.java =================================================================== RCS file: /cvsroot/javaprofiler/jpi/net/sourceforge/javaprofiler/jpi/VirtualMachineRef.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** VirtualMachineRef.java 15 Jul 2002 21:45:06 -0000 1.4 --- VirtualMachineRef.java 22 Jul 2002 17:49:59 -0000 1.5 *************** *** 21,28 **** package net.sourceforge.javaprofiler.jpi; ! public interface VirtualMachineRef extends VirtualMachineImageRef { Snapshot createSnapshot(); Snapshot createSnapshot( Snapshot.Configuration conf ); void suspendThreads(); void resumeThreads(); --- 21,51 ---- package net.sourceforge.javaprofiler.jpi; ! public interface VirtualMachineRef { ! /** ! * Creates the snapshot of the current profiling information in the ! * virtual machine. ! */ Snapshot createSnapshot(); + + /** + * Creates the snapshot of the current profiling information in the + * virtual machine. + */ Snapshot createSnapshot( Snapshot.Configuration conf ); + + /** + *Returns realtime image of library. After that you can access information in library realtime + * without creating snapshot. For one instace of VirtalMachineImpl it returns always the same refenrece. + */ + VirtualMachineImageRef getRealtimeImage(); + + /** + * Suspends all threads in the virtual machine. + */ void suspendThreads(); + + /** + * Resumess all threads in the virtual machine. + */ void resumeThreads(); *************** *** 101,104 **** --- 124,130 ---- /* * $Log$ + * Revision 1.5 2002/07/22 17:49:59 vachis + * realtime via getRealtimeImage() method, it no longer extends VirtualMachineImageRef + * * Revision 1.4 2002/07/15 21:45:06 vachis * method createSnapshot() accepts configuration class |
From: Pavel V. <va...@us...> - 2002-07-22 00:21:02
|
Update of /cvsroot/javaprofiler/test/module In directory usw-pr-cvs1:/tmp/cvs-serv25961 Added Files: TestAllocHistView.java Log Message: test of histogram view --- NEW FILE: TestAllocHistView.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ import java.util.*; import javax.swing.*; import javax.swing.table.*; import javax.swing.JFrame; import javax.swing.JScrollPane; import java.awt.*; import net.sourceforge.javaprofiler.module.views.*; import net.sourceforge.javaprofiler.jpi.*; import net.sourceforge.javaprofiler.jpi.connect.*; import net.sourceforge.javaprofiler.jpiimpl.connect.*; /** * * @author Pavel Vacha */ public class TestAllocHistView { VirtualMachineImageRef image; JFrame frame; //RefreshThread refreshTread; /** Creates a new instance of TestAllocHistView */ public TestAllocHistView() { try { VirtualMachineRef vm = connect(); //FIXME WARNING depends on iplementation image = (VirtualMachineImageRef) vm; ((net.sourceforge.javaprofiler.jpiimpl.realtime.ImageR) ((net.sourceforge.javaprofiler.jpiimpl.VirtualMachineImpl) vm). getRealtimeImage() ).refreshTypes(); //image = getSnapshot(vm); frame=new JFrame("Main"); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); JTable table = new AllocHistogramTable( new AllocHistogramTableModel( image.getTypes() ) ); table.setPreferredScrollableViewportSize(new Dimension(600, 600)); JScrollPane scrollPane = new JScrollPane( table ); frame.setSize( 800, 600 ); frame.getContentPane().add( scrollPane, BorderLayout.CENTER); } catch( ConnectingException e) { //System.err.println( "Error in connecting to profiled machine: "); //System.err.println( e.getMessage() ); //e.printStackTrace(); throw new RuntimeException( "Error in connecting to profiled machine: " + e.getMessage() ); } } private Snapshot getSnapshot( VirtualMachineRef vm ) { /* SnapshotImpl.Configuration conf = new SnapshotImpl.Configuration(); conf.withCPU = true; conf.withAlloc = true; conf.withMon = true; conf.withArenas = true; conf.withGC = true; conf.withFields = true; conf.withCPUTraces = true; conf.withMonTraces = true; conf.withAllocTraces = true; conf.withCPUThreads = true; conf.withMonThreads = true; conf.withAllocThreads = true; conf.withTypes = true; conf.withCallTree = true; //only traces with more hits than this will be extracted conf.CPUTraces_MinVal = IProf.NO_OPTIONAL_ARG; //2; //only traces with more allocations than this will be extracted conf.AllocTraces_MinVal = IProf.NO_OPTIONAL_ARG; //2; //only traces with more hits than this will be extracted conf.MonTraces_MinVal = IProf.NO_OPTIONAL_ARG; //2; if ( !conf.isValid() ) System.err.print( "Error in snapshot configuration!" ); */ return vm.createSnapshot(); } private VirtualMachineRef connect() throws ConnectingException { //try { Bootstrap.virtualMachineManager().defaultConnector(); Connector con = new SocketAttachConnector(); Map args = con.defaultArguments(); ((Connector.IntegerArgument) args.get("port")).setValue(25595); ((Connector.Argument) args.get("host")).setValue("localhost"); return (new SocketAttachConnector()).connect( args ); /*} }*/ } public void show() { //frame.pack(); frame.show(); //frame.setVisible(true); } public static void main( String[] arg) { // let's run the test TestAllocHistView test = new TestAllocHistView(); test.show(); } } //TODO //refreshing thread |
From: Pavel V. <va...@us...> - 2002-07-22 00:20:27
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/views In directory usw-pr-cvs1:/tmp/cvs-serv25853 Added Files: AllocHistogramTable.java AllocHistogramTableModel.java Log Message: histogram view --- NEW FILE: AllocHistogramTable.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.module.views; import java.awt.*; import javax.swing.*; import javax.swing.table.*; import javax.swing.border.*; import net.sourceforge.javaprofiler.jpi.AllocStat; /** * * @author Pavel Vacha */ public class AllocHistogramTable extends JTable { /** Creates a new instance of HistogramTable */ public AllocHistogramTable( AllocHistogramTableModel model ) { super(model); setDefaultRenderer(AllocStat.class, new HistogramBarRenderer(true) ); setDefaultRenderer(String.class, new LongStringRenderer() ); setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); JTextField textField = new JTextField(); TableColumn column = getColumnModel().getColumn(0); column.setPreferredWidth(500); column.setCellEditor( new DefaultCellEditor( textField ) ); getColumnModel().getColumn(3).setPreferredWidth(250); getColumnModel().getColumn(1).setPreferredWidth(100); getColumnModel().getColumn(2).setPreferredWidth(100); getColumnModel().getColumn(4).setPreferredWidth(100); getColumnModel().getColumn(5).setPreferredWidth(100); } protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); //string renderer with tooltips for log string private class LongStringRenderer extends JLabel implements TableCellRenderer { public LongStringRenderer() { super(); setOpaque( true ); setBorder(noFocusBorder); } public Component getTableCellRendererComponent( JTable table, Object astr, boolean isSelected, boolean hasFocus, int row, int column) { String str = (String) astr; if (isSelected) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } //setFont(table.getFont()); setFont( table.getFont().deriveFont( Font.BOLD ) ); if (hasFocus) { setBorder( UIManager.getBorder("Table.focusCellHighlightBorder") ); if (table.isCellEditable(row, column)) { super.setForeground( UIManager.getColor("Table.focusCellForeground") ); super.setBackground( UIManager.getColor("Table.focusCellBackground") ); } } else { setBorder(noFocusBorder); } setText( str ); //if ( str.length() > 50 ) // setToolTipText( str ); return this; } } //renderer of histogram bars //PENDING all private class HistogramBarRenderer extends JComponent implements TableCellRenderer { Border unselectedBorder = null; Border selectedBorder = null; boolean isBordered = true; JProgressBar bar; long barMax = 1000; public HistogramBarRenderer(boolean isBordered) { super(); this.isBordered = isBordered; bar = new JProgressBar(); bar.setMinimum(0); this.setLayout( new BorderLayout() ); this.add( BorderLayout.CENTER, bar ); } public Component getTableCellRendererComponent( JTable table, Object allocObj, boolean isSelected, boolean hasFocus, int row, int column) { AllocStat alloc = (AllocStat) allocObj; bar.setMaximum( 100 ); //percent while( barMax < alloc.getLiveInstancesCount() ) { barMax = barMax * 2; //PENDING REDRAW } bar.setValue( (int) (100*alloc.getLiveInstancesCount()/barMax) ); if (isBordered) { if (isSelected) { if (selectedBorder == null) { selectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getSelectionBackground()); } setBorder(selectedBorder); } else { if (unselectedBorder == null) { unselectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getBackground()); } setBorder(unselectedBorder); } } return this; } } //end of Renderers //editors //private class LongStringEditor extends } --- NEW FILE: AllocHistogramTableModel.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.module.views; import java.util.*; import javax.swing.table.AbstractTableModel; import net.sourceforge.javaprofiler.jpi.*; import java.lang.reflect.*; //PENDING remove java.reflection /** * * @author Pavel Vacha */ public class AllocHistogramTableModel extends AbstractTableModel { private List allocStats; private String columnNames[] = { "name", "count", "max count", "histogram", "space", "max space" }; private Class columnClasses[] = { String.class, Long.class, Long.class, AllocStat.class, Long.class, Long.class }; private Method method_getName; /** Creates a new instance of HistogramTableModel *@param allocStats list of <code> AllocStat </code> objects that have <code> getType() </code> method * At last one instance of <code> AllocStat </code> must be in the <code> List </code>. */ public AllocHistogramTableModel(List allocStats) { this.allocStats = allocStats; ListIterator iter = allocStats.listIterator(); while ( iter.hasNext() ) { AllocStat alloc = (AllocStat) iter.next(); alloc.addAllocStatListener( new HistogramStatListener() ); } ((TypeRef) allocStats.get(0)).getVirtualMachineImage() .addChildrenListener( Constants.TYPE, new HistogramChildrenListener() ); //PENDING listeners to other types //parent.addChildListener( type, new HistogramChildrenListener ); if ( ! (allocStats.get(0) instanceof TypeRef) ) { try { Method method_getName = allocStats.get(0).getClass() .getMethod( "getType", null ); } catch (NoSuchMethodException e) { throw new RuntimeException( e.getMessage() + " requested method: getType()" ); } } } public int getColumnCount() { return columnNames.length; } public int getRowCount() { return allocStats.size(); } public Object getValueAt(int rowIndex, int colIndex) { AllocStat alloc = (AllocStat) allocStats.get( rowIndex ); //??FIXME switch ( colIndex ) { case 0: { //FIXME if ( alloc instanceof TypeRef ) { return ((TypeRef) alloc).getName(); } //FIXME add interface with getType method try { return ((TypeRef) method_getName.invoke( alloc, null )).getName(); } catch (SecurityException e) { throw new RuntimeException( e.getMessage() + " requested method: getType()" ); } catch (IllegalAccessException e) { throw new RuntimeException( e.getMessage() + " requested method: getType()" ); } catch (InvocationTargetException e) { throw new RuntimeException( e.getMessage() + " requested method: getType()" ); } } case 1: { return new Long(alloc.getLiveInstancesCount() ); } case 2: { return new Long(alloc.getTotalInstancesCount() ); } case 3: { return alloc; } case 4: { return new Long(alloc.getLiveInstancesSize() ); } case 5: { return new Long(alloc.getTotalInstancesSize() ); } default: throw new RuntimeException( "Invalid column number: " + colIndex ); } } public String getColumnName(int col) { return columnNames[col]; } public Class getColumnClass(int col) { return columnClasses[col]; } public boolean isCellEditable(int rowIndex, int columnIndex) { //if ( columnIndex == 0 ) // return true; //It's true, beceaus it assumes special editor, that don't let you change anything //else return false; } //LISTENERS class HistogramStatListener implements AllocStatListener { public void allocStatChanged( AllocStatEvent event ) { //FIXME how to get index int index = allocStats.indexOf( event.getSource() ); fireTableRowsUpdated(index, index); } } class HistogramChildrenListener implements ChildrenListener { public void childrenAdded( ChildrenEvent event ) { int delta[] = event.getDeltaIndices(); int i=0,j=0; int len = delta.length; while (i<len) { j=i+1; while (delta[i] - delta[j] == i-j) { //pack neighbours into one event j++; if (j >= len ) break; } fireTableRowsInserted( i, j-1 ); i = j; } }; public void childrenChanged( ChildrenEvent event) { int delta[] = event.getDeltaIndices(); int i=0, j=0; int len = delta.length; while (i<len) { j=i+1; while (delta[i] - delta[j] == i-j) { //pack neighbours into one event j++; if (j >= len ) break; } fireTableRowsUpdated( i, j-1 ); i = j; } }; } } |
From: Pavel V. <va...@us...> - 2002-07-22 00:17:33
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv25249 Modified Files: VirtualMachineImpl.java Log Message: add implementation of realtime interface (fasade) Index: VirtualMachineImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/VirtualMachineImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** VirtualMachineImpl.java 15 Jul 2002 21:48:06 -0000 1.8 --- VirtualMachineImpl.java 22 Jul 2002 00:17:29 -0000 1.9 *************** *** 26,29 **** --- 26,30 ---- import net.sourceforge.javaprofiler.jpiimpl.commun.*; import net.sourceforge.javaprofiler.jpiimpl.data.*; + import net.sourceforge.javaprofiler.jpiimpl.realtime.*; /** *************** *** 37,40 **** --- 38,43 ---- private boolean isSuspendedVM; private Process process=null; + + private VirtualMachineImageRef realtime=null; /** *************** *** 45,48 **** --- 48,52 ---- public VirtualMachineImpl(IProf iprof) { this.iprof=iprof; + realtime = new ImageR( iprof, false ); } *************** *** 250,293 **** } public List getThreads() { ! return null; } public List getMethods() { ! return null; } public List getCPUTraces() { ! return null; } public List getAllocTraces() { ! return null; } public List getMonTraces() { ! return null; } public List getTypes() { ! return null; } public List getThreadGroups() { ! return null; } public List getClasses() { ! return null; } public List getGCRuns() { ! return null; } public void addChildrenListener( int type, ChildrenListener listener) { } public void removeChildrenListener( int type, ChildrenListener listener) { } --- 254,307 ---- } + //FIXME + /**Returns realtime image of library. After that you can access information in library + * withtout creating snapshot. For one instace of VirtalMachineImpl it returns the same object. + */ + public VirtualMachineImageRef getRealtimeImage() { + return realtime; + } + public List getThreads() { ! return realtime.getThreads(); } public List getMethods() { ! return realtime.getMethods(); } public List getCPUTraces() { ! return realtime.getCPUTraces(); } public List getAllocTraces() { ! return realtime.getAllocTraces(); } public List getMonTraces() { ! return realtime.getMonTraces(); } public List getTypes() { ! return realtime.getTypes(); } public List getThreadGroups() { ! return realtime.getThreadGroups(); } public List getClasses() { ! return realtime.getClasses(); } public List getGCRuns() { ! return realtime.getGCRuns(); } public void addChildrenListener( int type, ChildrenListener listener) { + realtime.addChildrenListener( type, listener ); } public void removeChildrenListener( int type, ChildrenListener listener) { + realtime.removeChildrenListener( type, listener ); } *************** *** 296,299 **** --- 310,316 ---- /* * $Log$ + * Revision 1.9 2002/07/22 00:17:29 vachis + * add implementation of realtime interface (fasade) + * * Revision 1.8 2002/07/15 21:48:06 vachis * method createSnapshot() accepts configuration class |
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv2231 Modified Files: AllocThreadMethodR.java AllocThreadTraceR.java AllocTraceR.java AllocTypeMethodR.java AllocTypeR.java AllocTypeThreadMethodR.java AllocTypeThreadR.java AllocTypeTraceR.java CPUThreadMethodR.java CPUTraceR.java MethodR.java MonThreadMethodR.java MonTraceR.java ThreadGroupR.java ThreadR.java Log Message: childrenAdded event firing Index: AllocThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadMethodR.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** AllocThreadMethodR.java 17 Jul 2002 22:11:14 -0000 1.9 --- AllocThreadMethodR.java 18 Jul 2002 08:48:20 -0000 1.10 *************** *** 80,86 **** protected transient AllocStatEvent allocEvent; private Map listenersMap=new HashMap(1); - private EventListenerList allocTypeThreadMethodListeners=new - EventListenerList(); - private EventListenerList allocThreadTraceListeners=new EventListenerList(); /** Constructs multi-rooted object --- 80,83 ---- Index: AllocThreadTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadTraceR.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** AllocThreadTraceR.java 11 Jul 2002 18:17:23 -0000 1.7 --- AllocThreadTraceR.java 18 Jul 2002 08:48:20 -0000 1.8 *************** *** 77,80 **** --- 77,81 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 203,206 **** --- 204,210 ---- void addAllocTypeThreadTrace(AllocTypeThreadTraceRef o) { allocTypeThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_TRACE, new Object[]{o}, new int[]{ + allocTypeThreadTraces.size()-1}), listenersMap); } *************** *** 332,341 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 336,362 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); } Index: AllocTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTraceR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** AllocTraceR.java 11 Jul 2002 18:17:23 -0000 1.8 --- AllocTraceR.java 18 Jul 2002 08:48:20 -0000 1.9 *************** *** 81,84 **** --- 81,85 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 188,195 **** --- 189,202 ---- void addAllocTypeTrace(AllocTypeTraceRef o) { allocTypeTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_TRACE, new Object[]{o}, new int[]{ + allocTypeTraces.size()-1}), listenersMap); } void addAllocThreadTrace(AllocThreadTraceRef o) { allocThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_THREAD_TRACE, new Object[]{o}, new int[]{ + allocThreadTraces.size()-1}), listenersMap); } *************** *** 332,341 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 339,367 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_THREAD_TRACE}); } Index: AllocTypeMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeMethodR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** AllocTypeMethodR.java 11 Jul 2002 18:17:23 -0000 1.8 --- AllocTypeMethodR.java 18 Jul 2002 08:48:20 -0000 1.9 *************** *** 77,80 **** --- 77,81 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 209,216 **** --- 210,223 ---- void addAllocTypeTrace(AllocTypeTraceRef o) { allocTypeTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_TRACE, new Object[]{o}, new int[]{ + allocTypeTraces.size()-1}), listenersMap); } void addAllocTypeThreadMethod(AllocTypeThreadMethodRef o) { allocTypeThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_METHOD, new Object[]{o}, new int[]{ + allocTypeThreadMethods.size()-1}), listenersMap); } *************** *** 302,311 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 309,337 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_TYPE_THREAD_METHOD}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_TYPE_THREAD_METHOD}); } Index: AllocTypeR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeR.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** AllocTypeR.java 11 Jul 2002 18:17:23 -0000 1.6 --- AllocTypeR.java 18 Jul 2002 08:48:20 -0000 1.7 *************** *** 81,84 **** --- 81,85 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** This constructor will find it's component class on its own through *************** *** 233,244 **** --- 234,254 ---- void addAllocTypeMethod(AllocTypeMethodRef o) { allocTypeMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_METHOD, new Object[]{o}, new int[]{ + allocTypeMethods.size()-1}), listenersMap); } void addAllocTypeTrace(AllocTypeTraceRef o) { allocTypeTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_TRACE, new Object[]{o}, new int[]{ + allocTypeTraces.size()-1}), listenersMap); } void addAllocTypeThread(AllocTypeThreadRef o) { allocTypeThreads.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD, new Object[]{o}, new int[]{ + allocTypeThreads.size()-1}), listenersMap); } *************** *** 393,402 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 403,433 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_METHOD, ! Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_TYPE_THREAD}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_METHOD, ! Constants.ALLOC_TYPE_TRACE, ! Constants.ALLOC_TYPE_THREAD}); } Index: AllocTypeThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadMethodR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** AllocTypeThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.8 --- AllocTypeThreadMethodR.java 18 Jul 2002 08:48:20 -0000 1.9 *************** *** 80,83 **** --- 80,84 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 207,210 **** --- 208,214 ---- void addAllocTypeThreadTrace(AllocTypeThreadTraceRef o) { allocTypeThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_TRACE, new Object[]{o}, new int[]{ + allocTypeThreadTraces.size()-1}), listenersMap); } *************** *** 341,350 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 345,371 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); } Index: AllocTypeThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadR.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** AllocTypeThreadR.java 11 Jul 2002 18:17:23 -0000 1.9 --- AllocTypeThreadR.java 18 Jul 2002 08:48:20 -0000 1.10 *************** *** 77,80 **** --- 77,81 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 216,223 **** --- 217,230 ---- void addAllocTypeThreadMethod (AllocTypeThreadMethodRef o) { allocTypeThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_METHOD, new Object[]{o}, new int[]{ + allocTypeThreadMethods.size()-1}), listenersMap); } void addAllocTypeThreadTrace(AllocTypeThreadTraceRef o) { allocTypeThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_TRACE, new Object[]{o}, new int[]{ + allocTypeThreadTraces.size()-1}), listenersMap); } *************** *** 317,326 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 324,352 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_METHOD, ! Constants.ALLOC_TYPE_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_METHOD, ! Constants.ALLOC_TYPE_THREAD_TRACE}); } Index: AllocTypeTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeTraceR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** AllocTypeTraceR.java 11 Jul 2002 18:17:23 -0000 1.8 --- AllocTypeTraceR.java 18 Jul 2002 08:48:20 -0000 1.9 *************** *** 76,79 **** --- 76,80 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient AllocStatEvent allocEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 202,205 **** --- 203,209 ---- void addAllocTypeThreadTrace(AllocTypeThreadTraceRef o) { allocTypeThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_TRACE, new Object[]{o}, new int[]{ + allocTypeThreadTraces.size()-1}), listenersMap); } *************** *** 312,321 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 316,342 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_TRACE}); } Index: CPUThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/CPUThreadMethodR.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** CPUThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.6 --- CPUThreadMethodR.java 18 Jul 2002 08:48:21 -0000 1.7 *************** *** 74,77 **** --- 74,78 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient CPUStatEvent CPUEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 185,188 **** --- 186,192 ---- void addCPUThreadTrace(CPUThreadTraceRef o) { cpuThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_THREAD_TRACE, new Object[]{o}, new int[]{ + cpuThreadTraces.size()-1}), listenersMap); } *************** *** 291,300 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 295,321 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_THREAD_TRACE}); } Index: CPUTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/CPUTraceR.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** CPUTraceR.java 11 Jul 2002 18:17:23 -0000 1.7 --- CPUTraceR.java 18 Jul 2002 08:48:21 -0000 1.8 *************** *** 76,79 **** --- 76,80 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient CPUStatEvent CPUEvent; + private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 184,187 **** --- 185,191 ---- void addCPUThreadTrace(CPUThreadTraceRef o) { cpuThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_THREAD_TRACE, new Object[]{o}, new int[]{ + cpuThreadTraces.size()-1}), listenersMap); } *************** *** 288,297 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 292,318 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_THREAD_TRACE}); } Index: MethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MethodR.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** MethodR.java 17 Jul 2002 12:25:36 -0000 1.9 --- MethodR.java 18 Jul 2002 08:48:21 -0000 1.10 *************** *** 104,107 **** --- 104,108 ---- protected transient CPUStatEvent CPUEvent; protected transient MonStatEvent monEvent; + private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 323,350 **** --- 324,372 ---- void addCPUTrace(CPUTraceRef o) { cpuTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_TRACE, new Object[]{o}, new int[]{ + cpuTraces.size()-1}), listenersMap); } void addAllocTrace(AllocTraceRef o) { allocTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TRACE, new Object[]{o}, new int[]{ + allocTraces.size()-1}), listenersMap); } void addMonTrace(MonTraceRef o) { monTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_TRACE, new Object[]{o}, new int[]{ + monTraces.size()-1}), listenersMap); } void addAllocTypeMethod(AllocTypeMethodRef o) { allocTypeMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_METHOD, new Object[]{o}, new int[]{ + allocTypeMethods.size()-1}), listenersMap); } void addAllocThreadMethod(AllocThreadMethodRef o) { allocThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_THREAD_METHOD, new Object[]{o}, new int[]{ + allocThreadMethods.size()-1}), listenersMap); } void addCPUThreadMethod(CPUThreadMethodRef o) { cpuThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_THREAD_METHOD, new Object[]{o}, new int[]{ + cpuThreadMethods.size()-1}), listenersMap); } void addMonThreadMethod(MonThreadMethodRef o) { monThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_THREAD_METHOD, new Object[]{o}, new int[]{ + monThreadMethods.size()-1}), listenersMap); } *************** *** 506,515 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 528,566 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_TRACE, ! Constants.ALLOC_TRACE, ! Constants.MON_TRACE, ! Constants.ALLOC_TYPE_METHOD, ! Constants.ALLOC_THREAD_METHOD, ! Constants.CPU_THREAD_METHOD, ! Constants.MON_THREAD_METHOD}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.CPU_TRACE, ! Constants.ALLOC_TRACE, ! Constants.MON_TRACE, ! Constants.ALLOC_TYPE_METHOD, ! Constants.ALLOC_THREAD_METHOD, ! Constants.CPU_THREAD_METHOD, ! Constants.MON_THREAD_METHOD}); } Index: MonThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MonThreadMethodR.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** MonThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.6 --- MonThreadMethodR.java 18 Jul 2002 08:48:21 -0000 1.7 *************** *** 74,77 **** --- 74,78 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient MonStatEvent monEvent; + private Map listenersMap=new HashMap(1); /** Constructs multi-rooted object *************** *** 185,188 **** --- 186,192 ---- void addMonThreadTrace(MonThreadTraceRef o) { monThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_THREAD_TRACE, new Object[]{o}, new int[]{ + monThreadTraces.size()-1}), listenersMap); } *************** *** 291,300 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 295,321 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.MON_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.MON_THREAD_TRACE}); } Index: MonTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MonTraceR.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** MonTraceR.java 11 Jul 2002 18:17:23 -0000 1.7 --- MonTraceR.java 18 Jul 2002 08:48:21 -0000 1.8 *************** *** 76,79 **** --- 76,80 ---- protected EventListenerList listenerList = new EventListenerList(); protected transient MonStatEvent monEvent; + private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 161,164 **** --- 162,168 ---- void addMonThreadTrace(MonThreadTraceRef o) { monThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_THREAD_TRACE, new Object[]{o}, new int[]{ + monThreadTraces.size()-1}), listenersMap); } *************** *** 276,285 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 280,306 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.MON_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.MON_THREAD_TRACE}); } Index: ThreadGroupR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ThreadGroupR.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** ThreadGroupR.java 17 Jul 2002 12:25:36 -0000 1.6 --- ThreadGroupR.java 18 Jul 2002 08:48:21 -0000 1.7 *************** *** 65,70 **** threads); ! /** A list of event listeners for this component. */ ! protected EventListenerList threadListeners = new EventListenerList(); /** Constructs new object with info. --- 65,69 ---- threads); ! private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 138,145 **** // package / private ! void addThread(ThreadRef thread) { ! threads.add(thread); ! fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, new Object[] ! {thread}, new int[]{threads.size()-1}), threadListeners); } --- 137,145 ---- // package / private ! void addThread(ThreadRef o) { ! threads.add(o); ! image.fireChildrenAdded(new ChildrenEvent(this, Constants. ! THREAD, new Object[]{o}, new int[]{ ! threads.size()-1}), listenersMap); } *************** *** 196,208 **** /** * Removes an <code>ChildrenListener</code> from this object. * @param l the listener to be removed */ public void removeChildrenListener(int type, ChildrenListener l) { ! if (type==Constants.THREAD) ! threadListeners.remove(ChildrenListener.class, l); ! else ! throw new IllegalArgumentException("Illegal child type."); } ! /** * Adds an <code>ChildrenListener</code> to this object. --- 196,208 ---- /** * Removes an <code>ChildrenListener</code> from this object. + * @param type Type of children to listen events for. Constants are defined + * in net.sourceforge.javaprofiler.jpi.Constants. * @param l the listener to be removed */ public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.THREAD}); } ! /** * Adds an <code>ChildrenListener</code> to this object. *************** *** 210,236 **** * dispatching thread, rather they are dispatched in the thread which * caused new data to be loaded. * @param l the listener to be added */ public void addChildrenListener(int type, ChildrenListener l) { ! if (type==Constants.THREAD) ! threadListeners.add(ChildrenListener.class, l); ! else ! throw new IllegalArgumentException("Illegal child type."); ! } ! ! /** ! * Notifies all listeners that have registered interest for ! * notification on this event type. The event instance ! * is taken from a parameter. ! * @param e the event to fire ! * @param list list holding the listeners to receive the event ! */ ! private void fireChildrenAdded(ChildrenEvent e, EventListenerList list) { ! // Guaranteed to return a non-null array ! Object[] listeners = list.getListenerList(); ! // Process the listeners last to first, notifying all ! for (int i = listeners.length-2; i>=0; i-=2) { ! ((ChildrenListener)listeners[i+1]).childrenAdded(e); ! } } } --- 210,220 ---- * dispatching thread, rather they are dispatched in the thread which * caused new data to be loaded. + * @param type Type of children to listen events for. Constants are defined + * in net.sourceforge.javaprofiler.jpi.Constants. * @param l the listener to be added */ public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.THREAD}); } } Index: ThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ThreadR.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** ThreadR.java 11 Jul 2002 18:17:23 -0000 1.9 --- ThreadR.java 18 Jul 2002 08:48:21 -0000 1.10 *************** *** 104,107 **** --- 104,108 ---- protected transient CPUStatEvent CPUEvent; protected transient MonStatEvent monEvent; + private Map listenersMap=new HashMap(1); /** Constructs new object with info. *************** *** 338,365 **** --- 339,387 ---- void addAllocTypeThread(AllocTypeThreadRef o) { allocTypeThreads.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD, new Object[]{o}, new int[]{ + allocTypeThreads.size()-1}), listenersMap); } void addAllocThreadMethod(AllocThreadMethodRef o) { allocThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_THREAD_METHOD, new Object[]{o}, new int[]{ + allocThreadMethods.size()-1}), listenersMap); } void addAllocThreadTrace(AllocThreadTraceRef o) { allocThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_THREAD_TRACE, new Object[]{o}, new int[]{ + allocThreadTraces.size()-1}), listenersMap); } void addCPUThreadMethod(CPUThreadMethodRef o) { cpuThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_THREAD_METHOD, new Object[]{o}, new int[]{ + cpuThreadMethods.size()-1}), listenersMap); } void addCPUThreadTrace(CPUThreadTraceRef o) { cpuThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + CPU_THREAD_TRACE, new Object[]{o}, new int[]{ + cpuThreadTraces.size()-1}), listenersMap); } void addMonThreadMethod(MonThreadMethodRef o) { monThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_THREAD_METHOD, new Object[]{o}, new int[]{ + monThreadMethods.size()-1}), listenersMap); } void addMonThreadTrace(MonThreadTraceRef o) { monThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + MON_THREAD_TRACE, new Object[]{o}, new int[]{ + monThreadTraces.size()-1}), listenersMap); } *************** *** 539,548 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 561,599 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD, ! Constants.ALLOC_THREAD_METHOD, ! Constants.ALLOC_THREAD_TRACE, ! Constants.CPU_THREAD_METHOD, ! Constants.CPU_THREAD_TRACE, ! Constants.MON_THREAD_METHOD, ! Constants.MON_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD, ! Constants.ALLOC_THREAD_METHOD, ! Constants.ALLOC_THREAD_TRACE, ! Constants.CPU_THREAD_METHOD, ! Constants.CPU_THREAD_TRACE, ! Constants.MON_THREAD_METHOD, ! Constants.MON_THREAD_TRACE}); } |
From: Lukas P. <pe...@us...> - 2002-07-17 22:11:18
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv18804 Modified Files: AllocThreadMethodR.java ImageR.java Log Message: added children events to some objects Index: AllocThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadMethodR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** AllocThreadMethodR.java 11 Jul 2002 18:17:23 -0000 1.8 --- AllocThreadMethodR.java 17 Jul 2002 22:11:14 -0000 1.9 *************** *** 77,82 **** /** A list of event listeners for this component. */ ! protected EventListenerList listenerList = new EventListenerList(); ! protected transient AllocStatEvent allocEvent; /** Constructs multi-rooted object --- 77,86 ---- /** A list of event listeners for this component. */ ! protected EventListenerList listenerList=new EventListenerList(); ! protected transient AllocStatEvent allocEvent; ! private Map listenersMap=new HashMap(1); ! private EventListenerList allocTypeThreadMethodListeners=new ! EventListenerList(); ! private EventListenerList allocThreadTraceListeners=new EventListenerList(); /** Constructs multi-rooted object *************** *** 211,218 **** --- 215,228 ---- void addAllocTypeThreadMethod(AllocTypeThreadMethodRef o) { allocTypeThreadMethods.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_TYPE_THREAD_METHOD, new Object[]{o}, new int[]{ + allocTypeThreadMethods.size()-1}), listenersMap); } void addAllocThreadTrace(AllocThreadTraceRef o) { allocThreadTraces.add(o); + image.fireChildrenAdded(new ChildrenEvent(this, Constants. + ALLOC_THREAD_TRACE, new Object[]{o}, new int[]{ + allocThreadTraces.size()-1}), listenersMap); } *************** *** 330,339 **** // ---------- listeners ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING ! } ! ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } --- 340,368 ---- // ---------- listeners ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! image.removeChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_METHOD, ! Constants.ALLOC_THREAD_TRACE}); ! } ! ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! image.addChildrenListenerChecked(type, l, listenersMap, ! new int[] {Constants.ALLOC_TYPE_THREAD_METHOD, ! Constants.ALLOC_THREAD_TRACE}); } Index: ImageR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ImageR.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** ImageR.java 17 Jul 2002 12:25:36 -0000 1.10 --- ImageR.java 17 Jul 2002 22:11:14 -0000 1.11 *************** *** 1224,1240 **** if (type==Constants.THREAD) threadListeners.remove(ChildrenListener.class, l); ! if (type==Constants.TYPE) typeListeners.remove(ChildrenListener.class, l); ! if (type==Constants.CLASS) classListeners.remove(ChildrenListener.class, l); ! if (type==Constants.METHOD) methodListeners.remove(ChildrenListener.class, l); ! if (type==Constants.CPU_TRACE) CPUTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.ALLOC_TRACE) allocTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.MON_TRACE) monTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.THREADGROUP) threadgroupListeners.remove(ChildrenListener.class, l); else --- 1224,1240 ---- if (type==Constants.THREAD) threadListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.TYPE) typeListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.CLASS) classListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.METHOD) methodListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.CPU_TRACE) CPUTraceListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.ALLOC_TRACE) allocTraceListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.MON_TRACE) monTraceListeners.remove(ChildrenListener.class, l); ! else if (type==Constants.THREADGROUP) threadgroupListeners.remove(ChildrenListener.class, l); else *************** *** 1254,1270 **** if (type==Constants.THREAD) threadListeners.add(ChildrenListener.class, l); ! if (type==Constants.TYPE) typeListeners.add(ChildrenListener.class, l); ! if (type==Constants.CLASS) classListeners.add(ChildrenListener.class, l); ! if (type==Constants.METHOD) methodListeners.add(ChildrenListener.class, l); ! if (type==Constants.CPU_TRACE) CPUTraceListeners.add(ChildrenListener.class, l); ! if (type==Constants.ALLOC_TRACE) allocTraceListeners.add(ChildrenListener.class, l); ! if (type==Constants.MON_TRACE) monTraceListeners.add(ChildrenListener.class, l); ! if (type==Constants.THREADGROUP) threadgroupListeners.add(ChildrenListener.class, l); else --- 1254,1270 ---- if (type==Constants.THREAD) threadListeners.add(ChildrenListener.class, l); ! else if (type==Constants.TYPE) typeListeners.add(ChildrenListener.class, l); ! else if (type==Constants.CLASS) classListeners.add(ChildrenListener.class, l); ! else if (type==Constants.METHOD) methodListeners.add(ChildrenListener.class, l); ! else if (type==Constants.CPU_TRACE) CPUTraceListeners.add(ChildrenListener.class, l); ! else if (type==Constants.ALLOC_TRACE) allocTraceListeners.add(ChildrenListener.class, l); ! else if (type==Constants.MON_TRACE) monTraceListeners.add(ChildrenListener.class, l); ! else if (type==Constants.THREADGROUP) threadgroupListeners.add(ChildrenListener.class, l); else *************** *** 1295,1298 **** --- 1295,1368 ---- for (int i = listeners.length-2; i>=0; i-=2) { ((ChildrenListener)listeners[i+1]).childrenAdded(e); + } + } + + // ---------------------------------------------- children listener support + + /** Removes an ChildrenListener from a specific event listener list. + * Event listener lists for different child types are hold in a Map. + * @param type Describes child type. Constants are defined in + * net.sourceforge.javaprofiler.jpi.Constants. + * @param l the listener to be added + * @param lMap map holding listener lists for different child types + * @param allowed Values that are allowed in the type argument. Other + * values cause an exception to be thrown + */ + void removeChildrenListenerChecked(int type, ChildrenListener l, Map lMap, + int[] allowed) { + int i; + for (i=0; i<allowed.length; i++) + if (type==allowed[i]) break; + if (i==allowed.length) + throw new RuntimeException("Illegal child type."); + + EventListenerList list=(EventListenerList) lMap.get(new Integer(type)); + if (list!=null) { + list.remove(ChildrenListener.class, l); + } + } + + /** Adds an ChildrenListener into a specific event listener list. Event + * listener lists for different child types are hold in a Map. + * @param type Describes child type. Constants are defined in + * net.sourceforge.javaprofiler.jpi.Constants. + * @param l the listener to be added + * @param lMap map holding listener lists for different child types + * @param allowed Values that are allowed in the type argument. Other + * values cause an exception to be thrown + */ + void addChildrenListenerChecked(int type, ChildrenListener l, Map lMap, + int[] allowed) { + int i; + for (i=0; i<allowed.length; i++) + if (type==allowed[i]) break; + if (i==allowed.length) + throw new RuntimeException("Illegal child type."); + + EventListenerList list=(EventListenerList) lMap.get(new Integer(type)); + if (list==null) { + list=new EventListenerList(); + lMap.put(new Integer(type), list); + } + list.add(ChildrenListener.class, l); + } + + /** + * Notifies all listeners that have registered interest for notification + * on this event type. Listeners list is taken from a map. + * @param e event to be fired + * @param lMap map holding listener lists for different child types + */ + void fireChildrenAdded(ChildrenEvent e, Map lMap) { + int type=e.getType(); + EventListenerList list=(EventListenerList) lMap.get(new Integer(type)); + if (list!=null) { + // Guaranteed to return a non-null array + Object[] listeners = list.getListenerList(); + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + ((ChildrenListener)listeners[i+1]).childrenAdded(e); + } } } |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:59
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/prof Modified Files: prof_gc.cpp prof_jvm.cpp prof_monitor.cpp prof_thread.cpp Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: prof_gc.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_gc.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** prof_gc.cpp 21 Nov 2001 22:31:44 -0000 1.9 --- prof_gc.cpp 17 Jul 2002 22:05:56 -0000 1.10 *************** *** 35,38 **** --- 35,39 ---- #include "../prof/prof.h" #include "../gc/gc.h" + #include "../delay/delay.h" void Prof::event_gcStart( JVMPI_Event* event) { *************** *** 55,59 **** GC* gc = new GC; ! gc->startTime = time( NULL); gcStat.add( gc); --- 56,60 ---- GC* gc = new GC; ! gc->startTime = Delay::getTime(); gcStat.add( gc); *************** *** 64,68 **** GC* gc = gcStat.first(); ! gc->endTime = time( NULL); gc->usedObjects = event->u.gc_info.used_objects; --- 65,69 ---- GC* gc = gcStat.first(); ! gc->endTime = Delay::getTime(); gc->usedObjects = event->u.gc_info.used_objects; Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** prof_jvm.cpp 16 Apr 2002 12:41:35 -0000 1.29 --- prof_jvm.cpp 17 Jul 2002 22:05:56 -0000 1.30 *************** *** 178,183 **** cout << "GC:" << endl; ! cout << "start: " << ctime( &gc->startTime) << endl; ! cout << "end: " << ctime( &gc->endTime) << endl; cout << endl; --- 178,187 ---- cout << "GC:" << endl; ! ! time_t st = (time_t)(gc->startTime/1000); ! cout << "start: " << ctime( &st) << endl; ! ! time_t et = (time_t)(gc->endTime/1000); ! cout << "end: " << ctime( &et) << endl; cout << endl; Index: prof_monitor.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_monitor.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** prof_monitor.cpp 15 Apr 2002 21:04:18 -0000 1.7 --- prof_monitor.cpp 17 Jul 2002 22:05:56 -0000 1.8 *************** *** 79,83 **** t->monitorEnter = 0; ! unsigned long curTime = Delay::getMilliticks(); if (curTime < t->monitorEnterTime) return; --- 79,83 ---- t->monitorEnter = 0; ! jlong curTime = Delay::getMilliticks(); if (curTime < t->monitorEnterTime) return; Index: prof_thread.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_thread.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** prof_thread.cpp 25 May 2002 00:05:06 -0000 1.17 --- prof_thread.cpp 17 Jul 2002 22:05:56 -0000 1.18 *************** *** 36,39 **** --- 36,40 ---- #include "../shared/groupThread.h" #include "../prof/synchronized.h" + #include "../delay/delay.h" int Prof::findParent( Thread* t, void** inout) { *************** *** 86,90 **** t->threadEnvId = envId; ! t->startTime = time( NULL); threads.add( t); --- 87,91 ---- t->threadEnvId = envId; ! t->startTime = Delay::getTime(); threads.add( t); *************** *** 124,128 **** if( t) { ! t->endTime = time( NULL); t->deactivate(); } --- 125,129 ---- if( t) { ! t->endTime = Delay::getTime(); t->deactivate(); } |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:59
|
Update of /cvsroot/javaprofiler/library/src/shared In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/shared Modified Files: thread.h Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: thread.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/thread.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** thread.h 25 May 2002 00:05:06 -0000 1.25 --- thread.h 17 Jul 2002 22:05:56 -0000 1.26 *************** *** 96,103 **** /// time when thread has started ! time_t startTime; /// time when thread has finished (or 0 if still active) ! time_t endTime; /// associated AllocThreadObjects --- 96,103 ---- /// time when thread has started ! jlong startTime; /// time when thread has finished (or 0 if still active) ! jlong endTime; /// associated AllocThreadObjects *************** *** 144,148 **** ** JVMPI_EVENT_MONITOR_CONTENDED_ENTER event. */ ! unsigned long monitorEnterTime; public: --- 144,148 ---- ** JVMPI_EVENT_MONITOR_CONTENDED_ENTER event. */ ! jlong monitorEnterTime; public: |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:59
|
Update of /cvsroot/javaprofiler/library/src/gc In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/gc Modified Files: gc.h Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: gc.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/gc/gc.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** gc.h 21 Nov 2001 22:31:43 -0000 1.12 --- gc.h 17 Jul 2002 22:05:56 -0000 1.13 *************** *** 64,71 **** /// time when GC started ! time_t startTime; /// time when GC finished ! time_t endTime; public: --- 64,71 ---- /// time when GC started ! jlong startTime; /// time when GC finished ! jlong endTime; public: |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:59
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/setup Modified Files: setup.cpp Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** setup.cpp 17 Jul 2002 18:40:36 -0000 1.13 --- setup.cpp 17 Jul 2002 22:05:56 -0000 1.14 *************** *** 61,86 **** _verbose = 1; ! if( options) processOptions( options); } void Setup::processOptions( const char* options) { - if( !options) return; - const char* p = options; const char* end; ! while( end = strchr( options, ',')) { ! int len = end-options; ! if( !memcmp( options, "verbose=on", len)) _verbose = 1; ! else if( !memcmp( options, "verbose=off", len)) _verbose = 0; ! options = end+1; ! } ! if( !strcmp( options, "verbose=on")) _verbose = 1; ! else if( !strcmp( options, "verbose=off")) _verbose = 0; if( _verbose) { --- 61,87 ---- _verbose = 1; ! processOptions( options); } void Setup::processOptions( const char* options) { const char* p = options; const char* end; ! if( options) { ! while( end = strchr( options, ',')) { ! int len = end-options; ! if( !memcmp( options, "verbose=on", len)) _verbose = 1; ! else if( !memcmp( options, "verbose=off", len)) _verbose = 0; ! ! options = end+1; ! } ! if( !strcmp( options, "verbose=on")) _verbose = 1; ! else if( !strcmp( options, "verbose=off")) _verbose = 0; ! } if( _verbose) { *************** *** 101,130 **** options = p; ! while( end = strchr( options, ',')) { ! int len = end-options; ! if( (len > 0) && (len < 100)) { ! char option[100]; ! memcpy( option, options, len); ! option[len] = '\0'; ! processOption( option); ! } ! options = end+1; ! } ! int len = strlen( options); ! if( (len > 0) && (len < 100)) { ! char option[100]; ! strcpy( option, options); ! processOption( option); } --- 102,134 ---- options = p; ! if( options) { ! while( end = strchr( options, ',')) { ! int len = end-options; ! if( (len > 0) && (len < 100)) { ! char option[100]; ! memcpy( option, options, len); ! option[len] = '\0'; ! processOption( option); ! } ! ! options = end+1; ! } ! int len = strlen( options); ! if( (len > 0) && (len < 100)) { ! char option[100]; ! strcpy( option, options); ! processOption( option); ! } } *************** *** 133,137 **** cout << endl << "sumarizing..." << endl; ! if( _verbose) printSumarize(); cout << endl << "profiling..." << endl; --- 137,141 ---- cout << endl << "sumarizing..." << endl; ! printSumarize(); cout << endl << "profiling..." << endl; |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:58
|
Update of /cvsroot/javaprofiler/library/src/delay In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/delay Modified Files: delay.cpp delay.h Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: delay.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** delay.cpp 21 Nov 2001 22:31:43 -0000 1.5 --- delay.cpp 17 Jul 2002 22:05:56 -0000 1.6 *************** *** 49,61 **** } ! unsigned long Delay::getMilliticks() { #ifdef WIN32 ! return timeGetTime(); #else ! timeval tv; ! gettimeofday(&tv, NULL); ! return (((unsigned long)tv.tv_sec * (unsigned long)1000) + ((unsigned long)tv.tv_usec / (unsigned long)1000)); #endif } --- 49,70 ---- } ! jlong Delay::getMilliticks() { #ifdef WIN32 ! return (jlong)timeGetTime(); #else ! timeval tv; ! gettimeofday( &tv, NULL); ! return (((jlong)tv.tv_sec * (jlong)1000) + ((jlong)tv.tv_usec / (jlong)1000)); ! #endif ! } ! ! jlong Delay::getTime() { ! ! #ifdef WIN32 ! return ((jlong)time( NULL)*1000+(jlong)timeGetTime()%1000); ! #else ! return getMilliticks(); #endif } Index: delay.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** delay.h 21 Nov 2001 22:31:43 -0000 1.5 --- delay.h 17 Jul 2002 22:05:56 -0000 1.6 *************** *** 59,63 **** ** @return ticks in milliseconds */ ! static unsigned long getMilliticks(); }; --- 59,69 ---- ** @return ticks in milliseconds */ ! static jlong getMilliticks(); ! ! /** Gets current time in milliseconds. ! ** ! ** @return time in milliseconds since 1.1.1970 */ ! ! static jlong getTime(); }; |
From: Marek P. <ma...@us...> - 2002-07-17 22:05:58
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv17399/src/cpu Modified Files: sampling.cpp sampling.h Log Message: fixes date represented in milliseconds since 1.1.1970 gc start/end times, thread start/end times Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** sampling.cpp 15 Apr 2002 21:04:17 -0000 1.14 --- sampling.cpp 17 Jul 2002 22:05:56 -0000 1.15 *************** *** 90,98 **** Prof* _prof = &Prof::prof(); ! unsigned long waitTime = 1; ! unsigned long avgSampleTime = 1; ! unsigned long lastSampleTime; ! unsigned long startTime; ! unsigned long endTime; #ifdef _DEBUG --- 90,98 ---- Prof* _prof = &Prof::prof(); ! jlong waitTime = 1; ! jlong avgSampleTime = 1; ! jlong lastSampleTime; ! jlong startTime; ! jlong endTime; #ifdef _DEBUG *************** *** 153,157 **** lastSampleTime = endTime - startTime; ! avgSampleTime = (int)(.9 * avgSampleTime + .1 * lastSampleTime); if (avgSampleTime == 0) avgSampleTime = 1; --- 153,157 ---- lastSampleTime = endTime - startTime; ! avgSampleTime = (jlong)(.9 * avgSampleTime + .1 * lastSampleTime); if (avgSampleTime == 0) avgSampleTime = 1; *************** *** 162,166 **** if (_cmd != CMD_TURN_ON) continue; ! Delay::delay(waitTime); } } --- 162,166 ---- if (_cmd != CMD_TURN_ON) continue; ! Delay::delay( waitTime); } } Index: sampling.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** sampling.h 18 Feb 2002 20:17:59 -0000 1.10 --- sampling.h 17 Jul 2002 22:05:56 -0000 1.11 *************** *** 147,152 **** public: ! unsigned long start; ! unsigned long finish; unsigned long samples; #endif // _DEBUG --- 147,152 ---- public: ! jlong start; ! jlong finish; unsigned long samples; #endif // _DEBUG |
From: Pavel V. <va...@us...> - 2002-07-17 21:37:42
|
Update of /cvsroot/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv5549 Modified Files: build.xml Log Message: realtime added to compilation and jar package Index: build.xml =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/build.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** build.xml 30 May 2002 22:34:35 -0000 1.10 --- build.xml 17 Jul 2002 21:37:38 -0000 1.11 *************** *** 53,58 **** <pathelement location="jpi"/> </src> ! <include name="net/**"/> ! <exclude name="net/sourceforge/javaprofiler/jpiimpl/realtime/**"/> </javac> </target> --- 53,58 ---- <pathelement location="jpi"/> </src> ! <include name="net/**/*"/> ! <!-- <exclude name="net/sourceforge/javaprofiler/jpiimpl/realtime/**"/> --> </javac> </target> |
From: Pavel V. <va...@us...> - 2002-07-17 21:37:15
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data In directory usw-pr-cvs1:/tmp/cvs-serv4736 Modified Files: SnapshotImpl.java Log Message: fixed exception handling Index: SnapshotImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/SnapshotImpl.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** SnapshotImpl.java 11 Jul 2002 18:21:37 -0000 1.26 --- SnapshotImpl.java 17 Jul 2002 21:37:10 -0000 1.27 *************** *** 38,42 **** public class SnapshotImpl implements Snapshot, Serializable { private String name; ! private long time; //PENDING transient private Map libIDs; //converts libIds to references --- 38,42 ---- public class SnapshotImpl implements Snapshot, Serializable { private String name; ! private long time; //PENDING //in milis, ? change to Date? transient private Map libIDs; //converts libIds to references *************** *** 173,185 **** //maybe use some configuration object public SnapshotImpl( IProf iprof, Configuration conf ) { - libIDs = new HashMap(); try { this.conf = (Configuration) conf.clone(); makeSnapshot( iprof ); ! } catch( Exception e) { ! System.err.println( e ); } - //PENDING - libIDs = null; } --- 173,185 ---- //maybe use some configuration object public SnapshotImpl( IProf iprof, Configuration conf ) { try { + libIDs = new HashMap(); this.conf = (Configuration) conf.clone(); makeSnapshot( iprof ); ! libIDs = null; ! } ! catch ( CloneNotSupportedException e ) { ! throw new RuntimeException( e.getMessage() ); } } *************** *** 384,390 **** private void makeSnapshot( IProf iprof ) { ! //PENDING ! //if ( haveSnapshot ) ! //throw vyjimku; long start = System.currentTimeMillis(); --- 384,389 ---- private void makeSnapshot( IProf iprof ) { ! if ( haveSnapshot ) ! throw new RuntimeException( "Can't create Snapshot, it already exists!"); long start = System.currentTimeMillis(); *************** *** 393,398 **** try { ! //PENDING ! //Add some info like time, data, etc. if (conf.withCPU || conf.withAlloc || conf.withMon) { --- 392,396 ---- try { ! time = System.currentTimeMillis(); if (conf.withCPU || conf.withAlloc || conf.withMon) { *************** *** 528,541 **** } catch ( COMMUN_Exception e ) { ! System.out.println( "Error in communication" ); ! e.printStackTrace(); ! } ! catch( Exception e ) { ! System.out.println( "Just error" ); ! e.printStackTrace(); } ! long end = System.currentTimeMillis(); ! System.out.println( "\n\nTime: " + (end - start) ); } --- 526,534 ---- } catch ( COMMUN_Exception e ) { ! throw new VMDisconnectedException(e.getMessage()); } ! long end = System.currentTimeMillis(); ! //System.out.println( "\n\nTime: " + (end - start) ); } *************** *** 605,609 **** int i=0; j++; ! //try { while ( iterInner.hasNext() ) { //dbg --- 598,602 ---- int i=0; j++; ! while ( iterInner.hasNext() ) { //dbg *************** *** 616,625 **** out.add( objInner ); } ! //dbg ! //} catch (Exception e) ! //{ ! // System.out.print("zz" + e.toString() + " " ); ! //}; ! if ( iter == null ) //one pass break; --- 609,613 ---- out.add( objInner ); } ! if ( iter == null ) //one pass break; *************** *** 630,653 **** postOpLst = null; } - //PENDING trow other exception catch ( BAD_OBJ_ID_Exception e ) { ! System.out.println( "Bad objID\n" ); ! } ! /* catch ( BAD_INFO_ID_Exception e ) { ! System.out.println( "Bad infoID\n" ); } - catch ( BAD_INFO_TYPE_Exception e ) { - System.out.println( "Bad info type\n" ); - }*/ catch ( BAD_COMMAND_Exception e ) { ! System.out.println( "Bad command\n" ); } catch ( UNKNOWN_Exception e ) { ! System.out.println( "Uknown exception\n" ); } - // catch ( Exception e ) { - // System.out.println( "Exception\n" ); - // } - }; --- 618,630 ---- postOpLst = null; } catch ( BAD_OBJ_ID_Exception e ) { ! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg); } catch ( BAD_COMMAND_Exception e ) { ! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg); } catch ( UNKNOWN_Exception e ) { ! throw new RuntimeException( e.getMessage() + " whatType: " + whatType + " optArg: " + optArg); } }; *************** *** 658,691 **** */ private CallTreeData threadCallTree (IProf iprof, int threadID) throws ! COMMUN_Exception, BAD_OBJ_ID_Exception, UNKNOWN_Exception { ! CallTreeData root = null; ! Iterator ctIt = iprof.getCallTreeThruIterator (threadID, true); ! ! if (ctIt == null) ! return null; ! if (ctIt.hasNext ()) { ! IProf.sCallTree sRoot = (IProf.sCallTree) ctIt.next(); ! MethodData method = (MethodData) libIDs.get( new Integer( ! sRoot.methodObjId) ); ! root = new CallTreeData(null, method, sRoot); ! root.missingChildrenCount = sRoot.numOfChildren; ! } ! ! CallTreeData current = root; ! while (current != null) { ! if (current.missingChildrenCount > 0) { ! IProf.sCallTree sChild = (IProf.sCallTree) ctIt.next(); MethodData method = (MethodData) libIDs.get( new Integer( ! sChild.methodObjId) ); ! CallTreeData child = new CallTreeData(current, method, sChild); ! current.missingChildrenCount--; ! child.missingChildrenCount = sChild.numOfChildren; ! current = child; ! } ! else { ! current = current.getParentData(); } } - return root; } --- 635,677 ---- */ private CallTreeData threadCallTree (IProf iprof, int threadID) throws ! COMMUN_Exception { ! try { ! CallTreeData root = null; ! Iterator ctIt = iprof.getCallTreeThruIterator (threadID, true); ! ! if (ctIt == null) ! return null; ! if (ctIt.hasNext ()) { ! IProf.sCallTree sRoot = (IProf.sCallTree) ctIt.next(); MethodData method = (MethodData) libIDs.get( new Integer( ! sRoot.methodObjId) ); ! root = new CallTreeData(null, method, sRoot); ! root.missingChildrenCount = sRoot.numOfChildren; ! } ! ! CallTreeData current = root; ! while (current != null) { ! if (current.missingChildrenCount > 0) { ! IProf.sCallTree sChild = (IProf.sCallTree) ctIt.next(); ! MethodData method = (MethodData) libIDs.get( new Integer( ! sChild.methodObjId) ); ! CallTreeData child = new CallTreeData(current, method, sChild); ! current.missingChildrenCount--; ! child.missingChildrenCount = sChild.numOfChildren; ! current = child; ! } ! else { ! current = current.getParentData(); ! } } + + return root; + } + catch ( BAD_OBJ_ID_Exception e ) { + throw new RuntimeException( e.getMessage() ); + } + catch ( UNKNOWN_Exception e ) { + throw new RuntimeException( e.getMessage() ); } } *************** *** 1111,1118 **** return newObj; } - //PENDING default: ! return null; ! //throw some exception } --- 1097,1102 ---- return newObj; } default: ! throw new RuntimeException("Unknown IProf type. whatType: \n" + whatType ); } *************** *** 1139,1148 **** } - //FIXME: - //GCRef, ArenaRef - //TODO: ! //? shloud I test a duplicity in lists? ! // write exception handling code properly // filters --- 1123,1128 ---- } //TODO: ! /// write exception handling code properly // filters *************** *** 1152,1155 **** --- 1132,1138 ---- /* * $Log$ + * Revision 1.27 2002/07/17 21:37:10 vachis + * fixed exception handling + * * Revision 1.26 2002/07/11 18:21:37 vachis * no message |
From: Marek P. <ma...@us...> - 2002-07-17 18:40:40
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv908/src/setup Modified Files: setup.cpp Log Message: small fixes Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** setup.cpp 17 Jul 2002 04:34:07 -0000 1.12 --- setup.cpp 17 Jul 2002 18:40:36 -0000 1.13 *************** *** 59,63 **** mon.linenoEnabled = 1; ! _verbose = 0; if( options) processOptions( options); --- 59,63 ---- mon.linenoEnabled = 1; ! _verbose = 1; if( options) processOptions( options); |
From: Marek P. <ma...@us...> - 2002-07-17 18:40:40
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv908 Modified Files: README Log Message: small fixes Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** README 15 Jul 2002 21:55:10 -0000 1.41 --- README 17 Jul 2002 18:40:36 -0000 1.42 *************** *** 488,491 **** --- 488,492 ---- verbose {on|off} additional information, verbose error messages + default: on |
From: Lukas P. <pe...@us...> - 2002-07-17 12:25:43
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv31114 Modified Files: ClassR.java ImageR.java MethodR.java ThreadGroupR.java Log Message: ChildrenListeners added for ImageR Index: ClassR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ClassR.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ClassR.java 2 Jul 2002 20:27:02 -0000 1.5 --- ClassR.java 17 Jul 2002 12:25:36 -0000 1.6 *************** *** 117,122 **** public void refreshMethods() { image.extractChildRoot(this.objId, IProf.CLASS_METHODS, image. ! methodFactory); } --- 117,124 ---- public void refreshMethods() { + List list=new ArrayList(); image.extractChildRoot(this.objId, IProf.CLASS_METHODS, image. ! methodFactory, list); ! image.addMethods(list); } *************** *** 186,190 **** void addMethod(MethodRef o) { methods.add(o); - // PENDING event } --- 188,191 ---- Index: ImageR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ImageR.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** ImageR.java 2 Jul 2002 20:27:02 -0000 1.9 --- ImageR.java 17 Jul 2002 12:25:36 -0000 1.10 *************** *** 36,39 **** --- 36,40 ---- import java.util.*; + import javax.swing.event.EventListenerList; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.*; *************** *** 114,130 **** final Constructor monThreadMethodFactory; final Constructor monThreadTraceFactory; - // multi-root ID factories - // final Constructor allocTypeMethodIDFactory; - // final Constructor allocTypeTraceIDFactory; - // final Constructor allocTypeThreadIDFactory; - // final Constructor allocThreadMethodIDFactory; - // final Constructor allocTypeThreadMethodIDFactory; - // final Constructor allocThreadTraceIDFactory; - // final Constructor allocTypeThreadTraceIDFactory; - // final Constructor cpuThreadMethodIDFactory; - // final Constructor cpuThreadTraceIDFactory; Set getAllFlags=new HashSet(); /** Constructs image that mirrors objects gained through given IProf. * It is not intended that end users construct this object, they shall --- 115,131 ---- final Constructor monThreadMethodFactory; final Constructor monThreadTraceFactory; Set getAllFlags=new HashSet(); + /** A list of event listeners for this component. */ + protected EventListenerList threadListeners = new EventListenerList(); + protected EventListenerList typeListeners = new EventListenerList(); + protected EventListenerList classListeners = new EventListenerList(); + protected EventListenerList methodListeners = new EventListenerList(); + protected EventListenerList CPUTraceListeners = new EventListenerList(); + protected EventListenerList allocTraceListeners = new EventListenerList(); + protected EventListenerList monTraceListeners = new EventListenerList(); + protected EventListenerList threadgroupListeners = new EventListenerList(); + /** Constructs image that mirrors objects gained through given IProf. * It is not intended that end users construct this object, they shall *************** *** 241,245 **** "net.sourceforge.javaprofiler.jpiimpl.realtime.MonThreadTraceR" ).getDeclaredConstructor(mrParameterTypes); - // init multi-root ID factories } catch (ClassNotFoundException e) { // PENDING --- 242,245 ---- *************** *** 257,260 **** --- 257,270 ---- } + /** This method performs a call to the profiled machine and gets new + * objects. Only usable for root object types. + * @param direction Type of the root object to query for. Guaranted to + * work are IProf.THREADS, IProf.OBJECT_TYPES, IProf.CLASSES, + * IProf.METHODS, IProf.CPU_TRACES, IProf.ALLOC_TRACES, IProf.MON_TRACES, + * IProf.GROUPS_OF_THREADS + * @param factory Factory used to create new objects holding information + * about the profiled counterparts. + * @param list List to which to append new objects. + */ private void extractRoot(int direction, java.lang.reflect.Constructor factory, List list) { *************** *** 277,282 **** } else { try { ! dataObject=(DataR) factory.newInstance(new Object[] {sid, this ! }); } catch (InstantiationException e) { // PENDING --- 287,292 ---- } else { try { ! dataObject=(DataR) factory.newInstance(new Object[] {sid, ! this}); } catch (InstantiationException e) { // PENDING *************** *** 299,333 **** } - private List getListFromDirection(int direction) { - List list; - switch (direction) { - case IProf.GROUP_THREADS: - list=threads; - break; - case IProf.CLASS_METHODS: - list=methods; - break; - case IProf.CPU_METHOD_TRACES: - list=cpuTraces; - break; - case IProf.ALLOC_METHOD_TRACES: - list=allocTraces; - break; - case IProf.MON_METHOD_TRACES: - list=monTraces; - break; - default: - throw new RuntimeException("Illegal object requested."); - } - return list; - } - // this method is for ThreadGroup->Thread, Class->Method, Method->*Trace // lists refreshing void extractChildRoot(Integer parentId, int direction, ! java.lang.reflect.Constructor factory) { // method should synchronize on image to be thread-safe - // Image has to add new objects into its lists. - List list=getListFromDirection(direction); Iterator itChildren; try { --- 309,317 ---- } // this method is for ThreadGroup->Thread, Class->Method, Method->*Trace // lists refreshing void extractChildRoot(Integer parentId, int direction, ! java.lang.reflect.Constructor factory, List list) { // method should synchronize on image to be thread-safe Iterator itChildren; try { *************** *** 475,479 **** --- 459,471 ---- */ public void refreshThreads() { + List children=threads; + int old=children.size(); extractRoot(IProf.THREADS, threadFactory, threads); + int nw=children.size(); + if (old!=nw && threadListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), threadListeners); + } } *************** *** 488,492 **** --- 480,492 ---- */ public void refreshTypes() { + List children=types; + int old=children.size(); extractRoot(IProf.OBJECT_TYPES, typeFactory, types); + int nw=children.size(); + if (old!=nw && typeListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.TYPE, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), typeListeners); + } } *************** *** 502,506 **** --- 502,514 ---- */ public void refreshClasses() { + List children=classes; + int old=children.size(); extractRoot(IProf.CLASSES, classFactory, classes); + int nw=children.size(); + if (old!=nw && classListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.CLASS, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), classListeners); + } } *************** *** 516,520 **** --- 524,536 ---- */ public void refreshMethods() { + List children=methods; + int old=children.size(); extractRoot(IProf.METHODS, methodFactory, methods); + int nw=children.size(); + if (old!=nw && methodListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.METHOD, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), methodListeners); + } } *************** *** 527,531 **** --- 543,555 ---- public void refreshCPUTraces() { + List children=cpuTraces; + int old=children.size(); extractRoot(IProf.CPU_TRACES, cpuTraceFactory, cpuTraces); + int nw=children.size(); + if (old!=nw && CPUTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.CPU_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), CPUTraceListeners); + } } *************** *** 537,541 **** --- 561,573 ---- public void refreshAllocTraces() { + List children=allocTraces; + int old=children.size(); extractRoot(IProf.ALLOC_TRACES, allocTraceFactory, allocTraces); + int nw=children.size(); + if (old!=nw && allocTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.ALLOC_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), allocTraceListeners); + } } *************** *** 547,551 **** --- 579,591 ---- public void refreshMonTraces() { + List children=monTraces; + int old=children.size(); extractRoot(IProf.MON_TRACES, monTraceFactory, monTraces); + int nw=children.size(); + if (old!=nw && monTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.MON_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), monTraceListeners); + } } *************** *** 557,561 **** --- 597,609 ---- public void refreshThreadGroups() { + List children=threadGroups; + int old=children.size(); extractRoot(IProf.GROUPS_OF_THREADS, threadGroupFactory, threadGroups); + int nw=children.size(); + if (old!=nw && threadgroupListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.THREADGROUP, + children.subList(old, nw).toArray(), createIndicesArray(old, nw) + ), threadgroupListeners); + } } *************** *** 685,689 **** */ ThreadR resolveThread(Integer oId) { ! return (ThreadR) resolveRoot(oId, null, threadIDFactory, threads); } --- 733,747 ---- */ ThreadR resolveThread(Integer oId) { ! List children=threads; ! int old=children.size(); ! ThreadR res=(ThreadR) resolveRoot(oId, null, threadIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && threadListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, ! children.subList(old, nw).toArray(), new int[]{old}), ! threadListeners); ! } ! return res; } *************** *** 694,698 **** ThreadR resolveThread(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! return (ThreadR) resolveRoot(oId, sid, threadFactory, threads); } --- 752,765 ---- ThreadR resolveThread(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! List children=threads; ! int old=children.size(); ! ThreadR res=(ThreadR) resolveRoot(oId, sid, threadFactory, threads); ! int nw=children.size(); ! if (old!=nw && threadListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, ! children.subList(old, nw).toArray(), new int[]{old}), ! threadListeners); ! } ! return res; } *************** *** 702,706 **** */ AllocTypeR resolveAllocType(Integer oId) { ! return (AllocTypeR) resolveRoot(oId, null, typeIDFactory, types); } --- 769,783 ---- */ AllocTypeR resolveAllocType(Integer oId) { ! List children=types; ! int old=children.size(); ! AllocTypeR res=(AllocTypeR) resolveRoot(oId, null, typeIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && typeListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.TYPE, ! children.subList(old, nw).toArray(), new int[]{old}), ! threadListeners); ! } ! return res; } *************** *** 711,715 **** AllocTypeR resolveAllocType(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! return (AllocTypeR) resolveRoot(oId, sid, typeFactory, types); } --- 788,801 ---- AllocTypeR resolveAllocType(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! List children=types; ! int old=children.size(); ! AllocTypeR res=(AllocTypeR) resolveRoot(oId, sid, typeFactory, types); ! int nw=children.size(); ! if (old!=nw && typeListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.TYPE, ! children.subList(old, nw).toArray(), new int[]{old}), ! threadListeners); ! } ! return res; } *************** *** 719,723 **** */ ClassR resolveClass(Integer oId) { ! return (ClassR) resolveRoot(oId, null, classIDFactory, classes); } --- 805,819 ---- */ ClassR resolveClass(Integer oId) { ! List children=classes; ! int old=children.size(); ! ClassR res=(ClassR) resolveRoot(oId, null, classIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && classListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.CLASS, ! children.subList(old, nw).toArray(), new int[]{old}), ! classListeners); ! } ! return res; } *************** *** 728,732 **** ClassR resolveClass(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! return (ClassR) resolveRoot(oId, sid, classFactory, classes); } --- 824,837 ---- ClassR resolveClass(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! List children=classes; ! int old=children.size(); ! ClassR res=(ClassR) resolveRoot(oId, sid, classFactory, classes); ! int nw=children.size(); ! if (old!=nw && classListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.CLASS, ! children.subList(old, nw).toArray(), new int[]{old}), ! classListeners); ! } ! return res; } *************** *** 736,740 **** */ MethodR resolveMethod(Integer oId) { ! return (MethodR) resolveRoot(oId, null, methodIDFactory, methods); } --- 841,855 ---- */ MethodR resolveMethod(Integer oId) { ! List children=methods; ! int old=children.size(); ! MethodR res=(MethodR) resolveRoot(oId, null, methodIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && methodListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.METHOD, ! children.subList(old, nw).toArray(), new int[]{old}), ! methodListeners); ! } ! return res; } *************** *** 745,749 **** MethodR resolveMethod(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! return (MethodR) resolveRoot(oId, sid, methodFactory, methods); } --- 860,873 ---- MethodR resolveMethod(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! List children=methods; ! int old=children.size(); ! MethodR res=(MethodR) resolveRoot(oId, sid, methodFactory, methods); ! int nw=children.size(); ! if (old!=nw && methodListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.METHOD, ! children.subList(old, nw).toArray(), new int[]{old}), ! methodListeners); ! } ! return res; } *************** *** 753,758 **** */ AllocTraceR resolveAllocTrace(Integer oId) { ! return (AllocTraceR) resolveRoot(oId, null, allocTraceIDFactory, ! allocTraces); } --- 877,891 ---- */ AllocTraceR resolveAllocTrace(Integer oId) { ! List children=allocTraces; ! int old=children.size(); ! AllocTraceR res=(AllocTraceR) resolveRoot(oId, null, allocTraceIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && allocTraceListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.ALLOC_TRACE, ! children.subList(old, nw).toArray(), new int[]{old}), ! allocTraceListeners); ! } ! return res; } *************** *** 763,768 **** AllocTraceR resolveAllocTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! return (AllocTraceR) resolveRoot(oId, sid, allocTraceFactory, allocTraces); } --- 896,910 ---- AllocTraceR resolveAllocTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! List children=allocTraces; ! int old=children.size(); ! AllocTraceR res=(AllocTraceR) resolveRoot(oId, sid, allocTraceFactory, allocTraces); + int nw=children.size(); + if (old!=nw && allocTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.ALLOC_TRACE, + children.subList(old, nw).toArray(), new int[]{old}), + allocTraceListeners); + } + return res; } *************** *** 772,777 **** */ CPUTraceR resolveCPUTrace(Integer oId) { ! return (CPUTraceR) resolveRoot(oId, null, cpuTraceIDFactory, ! cpuTraces); } --- 914,928 ---- */ CPUTraceR resolveCPUTrace(Integer oId) { ! List children=cpuTraces; ! int old=children.size(); ! CPUTraceR res=(CPUTraceR) resolveRoot(oId, null, cpuTraceIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && CPUTraceListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.CPU_TRACE, ! children.subList(old, nw).toArray(), new int[]{old}), ! CPUTraceListeners); ! } ! return res; } *************** *** 782,787 **** CPUTraceR resolveCPUTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! return (CPUTraceR) resolveRoot(oId, sid, cpuTraceFactory, cpuTraces); } --- 933,947 ---- CPUTraceR resolveCPUTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! List children=cpuTraces; ! int old=children.size(); ! CPUTraceR res=(CPUTraceR) resolveRoot(oId, sid, cpuTraceFactory, cpuTraces); + int nw=children.size(); + if (old!=nw && CPUTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.CPU_TRACE, + children.subList(old, nw).toArray(), new int[]{old}), + CPUTraceListeners); + } + return res; } *************** *** 791,796 **** */ MonTraceR resolveMonTrace(Integer oId) { ! return (MonTraceR) resolveRoot(oId, null, monTraceIDFactory, ! monTraces); } --- 951,965 ---- */ MonTraceR resolveMonTrace(Integer oId) { ! List children=monTraces; ! int old=children.size(); ! MonTraceR res=(MonTraceR) resolveRoot(oId, null, monTraceIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && monTraceListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.MON_TRACE, ! children.subList(old, nw).toArray(), new int[]{old}), ! monTraceListeners); ! } ! return res; } *************** *** 801,806 **** MonTraceR resolveMonTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! return (MonTraceR) resolveRoot(oId, sid, monTraceFactory, monTraces); } --- 970,984 ---- MonTraceR resolveMonTrace(IProf.sID sid) { Integer oId = new Integer(sid.objId); ! List children=monTraces; ! int old=children.size(); ! MonTraceR res=(MonTraceR) resolveRoot(oId, sid, monTraceFactory, monTraces); + int nw=children.size(); + if (old!=nw && monTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.MON_TRACE, + children.subList(old, nw).toArray(), new int[]{old}), + monTraceListeners); + } + return res; } *************** *** 810,815 **** */ ThreadGroupR resolveThreadGroup(Integer oId) { ! return (ThreadGroupR) resolveRoot(oId, null, threadGroupIDFactory, ! threadGroups); } --- 988,1002 ---- */ ThreadGroupR resolveThreadGroup(Integer oId) { ! List children=threadGroups; ! int old=children.size(); ! ThreadGroupR res=(ThreadGroupR) resolveRoot(oId, null, threadGroupIDFactory, ! children); ! int nw=children.size(); ! if (old!=nw && threadgroupListeners.getListenerCount()!=0) { ! fireChildrenAdded(new ChildrenEvent(this, Constants.THREADGROUP, ! children.subList(old, nw).toArray(), new int[]{old}), ! threadgroupListeners); ! } ! return res; } *************** *** 820,827 **** ThreadGroupR resolveThreadGroup(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! return (ThreadGroupR) resolveRoot(oId, sid, threadGroupFactory, threadGroups); } // ------------------------------------------- getAll / getChanged wrapping --- 1007,1095 ---- ThreadGroupR resolveThreadGroup(IProf.sID sid) { Integer oId=new Integer(sid.objId); ! List children=threadGroups; ! int old=children.size(); ! ThreadGroupR res=(ThreadGroupR) resolveRoot(oId, sid, threadGroupFactory, threadGroups); + int nw=children.size(); + if (old!=nw && threadgroupListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.THREADGROUP, + children.subList(old, nw).toArray(), new int[]{old}), + threadgroupListeners); + } + return res; } + // ------------------------------------------------------ children addition + + void addThreads(List l) { + if (! l.isEmpty()) { + List children=threads; + int old=children.size(); + children.addAll(l); + int nw=children.size(); + if (threadListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, + children.subList(old, nw).toArray(), createIndicesArray(old, + nw)), threadListeners); + } + } + } + + void addMethods(List l) { + if (! l.isEmpty()) { + List children=methods; + int old=children.size(); + children.addAll(l); + int nw=children.size(); + if (methodListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.METHOD, + children.subList(old, nw).toArray(), createIndicesArray(old, + nw)), methodListeners); + } + } + } + + void addCPUTraces(List l) { + if (! l.isEmpty()) { + List children=cpuTraces; + int old=children.size(); + children.addAll(l); + int nw=children.size(); + if (CPUTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.CPU_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, + nw)), CPUTraceListeners); + } + } + } + + void addAllocTraces(List l) { + if (! l.isEmpty()) { + List children=allocTraces; + int old=children.size(); + children.addAll(l); + int nw=children.size(); + if (allocTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.ALLOC_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, + nw)), allocTraceListeners); + } + } + } + + void addMonTraces(List l) { + if (! l.isEmpty()) { + List children=monTraces; + int old=children.size(); + children.addAll(l); + int nw=children.size(); + if (monTraceListeners.getListenerCount()!=0) { + fireChildrenAdded(new ChildrenEvent(this, Constants.MON_TRACE, + children.subList(old, nw).toArray(), createIndicesArray(old, + nw)), monTraceListeners); + } + } + } + // ------------------------------------------- getAll / getChanged wrapping *************** *** 945,959 **** } ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING } public List getGCRuns() { // PENDING return null; - } - - public void addChildrenListener(int type, ChildrenListener listener) { - // PENDING } --- 1213,1304 ---- } ! // -------------------------------------------------------------- listeners ! ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param type Type of children to listen events for. Constants are defined ! * in net.sourceforge.javaprofiler.jpi.Constants. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! if (type==Constants.THREAD) ! threadListeners.remove(ChildrenListener.class, l); ! if (type==Constants.TYPE) ! typeListeners.remove(ChildrenListener.class, l); ! if (type==Constants.CLASS) ! classListeners.remove(ChildrenListener.class, l); ! if (type==Constants.METHOD) ! methodListeners.remove(ChildrenListener.class, l); ! if (type==Constants.CPU_TRACE) ! CPUTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.ALLOC_TRACE) ! allocTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.MON_TRACE) ! monTraceListeners.remove(ChildrenListener.class, l); ! if (type==Constants.THREADGROUP) ! threadgroupListeners.remove(ChildrenListener.class, l); ! else ! throw new IllegalArgumentException("Illegal child type."); } + /** + * Adds an <code>ChildrenListener</code> to this object. + * <strong>Warning:</strong> Events are not dispatched in the swing event- + * dispatching thread, rather they are dispatched in the thread which + * caused new data to be loaded. + * @param type Type of children to listen events for. Constants are defined + * in net.sourceforge.javaprofiler.jpi.Constants. + * @param l the listener to be added + */ + public void addChildrenListener(int type, ChildrenListener l) { + if (type==Constants.THREAD) + threadListeners.add(ChildrenListener.class, l); + if (type==Constants.TYPE) + typeListeners.add(ChildrenListener.class, l); + if (type==Constants.CLASS) + classListeners.add(ChildrenListener.class, l); + if (type==Constants.METHOD) + methodListeners.add(ChildrenListener.class, l); + if (type==Constants.CPU_TRACE) + CPUTraceListeners.add(ChildrenListener.class, l); + if (type==Constants.ALLOC_TRACE) + allocTraceListeners.add(ChildrenListener.class, l); + if (type==Constants.MON_TRACE) + monTraceListeners.add(ChildrenListener.class, l); + if (type==Constants.THREADGROUP) + threadgroupListeners.add(ChildrenListener.class, l); + else + throw new IllegalArgumentException("Illegal child type."); + } + + /** Returns an array of int containing all numbers from <code>from</code> + * (inclusive) to <code>to</code> (exclusive). + */ + private int[] createIndicesArray(int from, int to) { + int[] r=new int[to-from]; + for (int i=0; i<(to-from); i++) + r[i]=i+from; + return r; + } + + /** + * Notifies all listeners that have registered interest for + * notification on this event type. The event instance + * is taken from a parameter. + * @param e the event to fire + * @param list list holding the listeners to receive the event + */ + private void fireChildrenAdded(ChildrenEvent e, EventListenerList list) { + // Guaranteed to return a non-null array + Object[] listeners = list.getListenerList(); + // Process the listeners last to first, notifying all + for (int i = listeners.length-2; i>=0; i-=2) { + ((ChildrenListener)listeners[i+1]).childrenAdded(e); + } + } + public List getGCRuns() { // PENDING return null; } Index: MethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MethodR.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** MethodR.java 11 Jul 2002 18:17:23 -0000 1.8 --- MethodR.java 17 Jul 2002 12:25:36 -0000 1.9 *************** *** 156,161 **** public void refreshCPUTraces() { image.extractChildRoot(this.objId, IProf.CPU_METHOD_TRACES, image. ! cpuTraceFactory); } --- 156,163 ---- public void refreshCPUTraces() { + List list=new ArrayList(); image.extractChildRoot(this.objId, IProf.CPU_METHOD_TRACES, image. ! cpuTraceFactory, list); ! image.addCPUTraces(list); } *************** *** 167,172 **** public void refreshAllocTraces() { image.extractChildRoot(this.objId, IProf.ALLOC_METHOD_TRACES, image. ! allocTraceFactory); } --- 169,176 ---- public void refreshAllocTraces() { + List list=new ArrayList(); image.extractChildRoot(this.objId, IProf.ALLOC_METHOD_TRACES, image. ! allocTraceFactory, list); ! image.addAllocTraces(list); } *************** *** 178,183 **** public void refreshMonTraces() { image.extractChildRoot(this.objId, IProf.MON_METHOD_TRACES, image. ! monTraceFactory); } --- 182,189 ---- public void refreshMonTraces() { + List list=new ArrayList(); image.extractChildRoot(this.objId, IProf.MON_METHOD_TRACES, image. ! monTraceFactory, list); ! image.addMonTraces(list); } Index: ThreadGroupR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ThreadGroupR.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ThreadGroupR.java 2 Jul 2002 20:27:02 -0000 1.5 --- ThreadGroupR.java 17 Jul 2002 12:25:36 -0000 1.6 *************** *** 36,39 **** --- 36,40 ---- import java.util.*; + import javax.swing.event.EventListenerList; import net.sourceforge.javaprofiler.jpi.*; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; *************** *** 64,67 **** --- 65,71 ---- threads); + /** A list of event listeners for this component. */ + protected EventListenerList threadListeners = new EventListenerList(); + /** Constructs new object with info. * @param sid Object with data from communication layer. *************** *** 95,100 **** public void refreshThreads() { image.extractChildRoot(this.objId, IProf.GROUP_THREADS, image. ! threadFactory); } --- 99,106 ---- public void refreshThreads() { + List list=new ArrayList(); image.extractChildRoot(this.objId, IProf.GROUP_THREADS, image. ! threadFactory, list); ! image.addThreads(list); } *************** *** 134,138 **** void addThread(ThreadRef thread) { threads.add(thread); ! // PENDING event } --- 140,145 ---- void addThread(ThreadRef thread) { threads.add(thread); ! fireChildrenAdded(new ChildrenEvent(this, Constants.THREAD, new Object[] ! {thread}, new int[]{threads.size()-1}), threadListeners); } *************** *** 185,195 **** } ! public void removeChildrenListener(int type, ChildrenListener listener) { ! // PENDING } ! public void addChildrenListener(int type, ChildrenListener listener) { ! // PENDING } } --- 192,236 ---- } ! // -------------------------------------------------------------- listeners ! ! /** ! * Removes an <code>ChildrenListener</code> from this object. ! * @param l the listener to be removed ! */ ! public void removeChildrenListener(int type, ChildrenListener l) { ! if (type==Constants.THREAD) ! threadListeners.remove(ChildrenListener.class, l); ! else ! throw new IllegalArgumentException("Illegal child type."); } ! /** ! * Adds an <code>ChildrenListener</code> to this object. ! * <strong>Warning:</strong> Events are not dispatched in the swing event- ! * dispatching thread, rather they are dispatched in the thread which ! * caused new data to be loaded. ! * @param l the listener to be added ! */ ! public void addChildrenListener(int type, ChildrenListener l) { ! if (type==Constants.THREAD) ! threadListeners.add(ChildrenListener.class, l); ! else ! throw new IllegalArgumentException("Illegal child type."); } + /** + * Notifies all listeners that have registered interest for + * notification on this event type. The event instance + * is taken from a parameter. + * @param e the event to fire + * @param list list holding the listeners to receive the event + */ + private void fireChildrenAdded(ChildrenEvent e, EventListenerList list) { + // Guaranteed to return a non-null array + Object[] listeners = list.getListenerList(); + // Process the listeners last to first, notifying all + for (int i = listeners.length-2; i>=0; i-=2) { + ((ChildrenListener)listeners[i+1]).childrenAdded(e); + } + } } |
From: Marek P. <ma...@us...> - 2002-07-17 04:34:11
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv3513/src/setup Modified Files: setup.cpp Log Message: information about release/debug version added Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** setup.cpp 15 Jul 2002 21:55:13 -0000 1.11 --- setup.cpp 17 Jul 2002 04:34:07 -0000 1.12 *************** *** 88,91 **** --- 88,98 ---- cout << endl << "Java Profiling Tool - dynamic profiling library" << endl; cout << "http://javaprofiler.sourceforge.net/" << endl; + + #ifndef _DEBUG + cout << "release version, "; + #else + cout << "debug version, "; + #endif + cout << "build: " << __DATE__ << " " << __TIME__ << endl << endl; cout << "analyzing arguments..." << endl; |
From: Pavel V. <va...@us...> - 2002-07-16 22:15:52
|
Update of /cvsroot/javaprofiler/test/module In directory usw-pr-cvs1:/tmp/cvs-serv10402 Modified Files: MainThreads.java Log Message: package removed Index: MainThreads.java =================================================================== RCS file: /cvsroot/javaprofiler/test/module/MainThreads.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** MainThreads.java 15 Jul 2002 11:20:22 -0000 1.1 --- MainThreads.java 16 Jul 2002 22:15:48 -0000 1.2 *************** *** 1,3 **** ! package net.sourceforge.javaprofiler.module.views; import javax.swing.*; --- 1,3 ---- ! //package net.sourceforge.javaprofiler.module.views; import javax.swing.*; *************** *** 9,12 **** --- 9,14 ---- import net.sourceforge.javaprofiler.jpiimpl.commun.*; import net.sourceforge.javaprofiler.jpiimpl.realtime.*; + import net.sourceforge.javaprofiler.module.views.*; + /** Example of using TimeSeriesGraph to show number of running threads. |
From: Marek P. <ma...@us...> - 2002-07-15 21:55:44
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv25109/src/commun Modified Files: iprof.cpp Log Message: verbose messages added new "verbose={on|off}" command-line argument Index: iprof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** iprof.cpp 15 Apr 2002 21:04:17 -0000 1.16 --- iprof.cpp 15 Jul 2002 21:55:11 -0000 1.17 *************** *** 67,72 **** _commun = new CommunSocket( setup.com.connectMode, ! setup.com.hostname, ! setup.com.port); else _commun = new CommunShMem( setup.com.shmemId, setup.com.shmemSize); --- 67,72 ---- _commun = new CommunSocket( setup.com.connectMode, ! setup.com.hostname, ! setup.com.port); else _commun = new CommunShMem( setup.com.shmemId, setup.com.shmemSize); *************** *** 118,122 **** firstTime = 0; } ! else { buf.clear(); --- 118,122 ---- firstTime = 0; } ! else { buf.clear(); |
From: Marek P. <ma...@us...> - 2002-07-15 21:55:43
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv25109 Modified Files: README Log Message: verbose messages added new "verbose={on|off}" command-line argument Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** README 25 Apr 2002 14:38:39 -0000 1.40 --- README 15 Jul 2002 21:55:10 -0000 1.41 *************** *** 486,491 **** default: server ! version date and time when this ! dynamic library was built --- 486,491 ---- default: server ! verbose {on|off} additional information, ! verbose error messages |
From: Marek P. <ma...@us...> - 2002-07-15 21:55:16
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv25109/src/setup Modified Files: setup.cpp setup.h Log Message: verbose messages added new "verbose={on|off}" command-line argument Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** setup.cpp 22 Mar 2002 21:22:42 -0000 1.10 --- setup.cpp 15 Jul 2002 21:55:13 -0000 1.11 *************** *** 36,40 **** #include "../main/const.h" ! Setup::Setup( char* options) { alloc.turnedOn = 1; --- 36,40 ---- #include "../main/const.h" ! Setup::Setup( const char* options) { alloc.turnedOn = 1; *************** *** 59,111 **** mon.linenoEnabled = 1; if( options) processOptions( options); } ! void Setup::processOptions( char* options) { ! ! char option[100]; ! char* end; ! int len; if( !options) return; ! while( end = strchr(options, ',')) { ! len = end - options; if( (len > 0) && (len < 100)) { ! strncpy( option, options, len); option[len] = '\0'; processOption( option); } ! options = end + 1; } ! len = strlen( options); if( (len > 0) && (len < 100)) { strcpy( option, options); processOption( option); } - } ! void Setup::processOption( char* option) { ! char* eq; ! if( !(eq = strchr( option, '='))) { ! if( !strcmp( option, "version")) { ! cout << "Java Profiling Tool - profiler library" << endl; ! cout << "http://javaprofiler.sourceforge.net/" << endl << endl; ! cout << "build: " << __DATE__ << " " << __TIME__ << endl << endl; ! } ! return; ! } *eq = '\0'; --- 59,140 ---- mon.linenoEnabled = 1; + _verbose = 0; + if( options) processOptions( options); } ! void Setup::processOptions( const char* options) { if( !options) return; ! const char* p = options; ! const char* end; ! ! while( end = strchr( options, ',')) { ! ! int len = end-options; ! ! if( !memcmp( options, "verbose=on", len)) _verbose = 1; ! else if( !memcmp( options, "verbose=off", len)) _verbose = 0; ! ! options = end+1; ! } ! ! if( !strcmp( options, "verbose=on")) _verbose = 1; ! else if( !strcmp( options, "verbose=off")) _verbose = 0; ! ! if( _verbose) { ! ! cout << endl << "Java Profiling Tool - dynamic profiling library" << endl; ! cout << "http://javaprofiler.sourceforge.net/" << endl; ! cout << "build: " << __DATE__ << " " << __TIME__ << endl << endl; ! cout << "analyzing arguments..." << endl; ! } ! ! options = p; ! ! while( end = strchr( options, ',')) { ! int len = end-options; if( (len > 0) && (len < 100)) { ! char option[100]; ! ! memcpy( option, options, len); option[len] = '\0'; + processOption( option); } ! options = end+1; } ! int len = strlen( options); if( (len > 0) && (len < 100)) { + char option[100]; + strcpy( option, options); + processOption( option); } ! if( _verbose) { ! cout << endl << "sumarizing..." << endl; ! if( _verbose) printSumarize(); ! cout << endl << "profiling..." << endl; ! } ! } ! void Setup::processOption( char* option) { ! char* eq = strchr( option, '='); ! ! if( !eq) return; *eq = '\0'; *************** *** 113,274 **** } ! void Setup::setParameter( char* name, char* value) { ! if( !strcmp( name, "alloc")) { ! ! if( !strcmp( value, "on")) alloc.turnedOn = 1; ! else if( !strcmp( value, "off")) alloc.turnedOn = 0; ! return; ! } ! if( !strcmp( name, "alloc_level")) { ! ! if( !strcmp( value, "object")) alloc.level = LEVEL_OBJECT; ! else if( !strcmp( value, "method")) alloc.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) alloc.level = LEVEL_TRACE; ! return; ! } ! if( !strcmp( name, "alloc_trace_depth")) { ! ! int depth = atoi( value); ! if( depth > 0) { ! if( depth > MAX_TRACE) depth = MAX_TRACE; ! alloc.traceDepth = depth; ! } ! return; ! } ! if( !strcmp( name, "alloc_thread")) { ! ! if( !strcmp( value, "on")) alloc.threadsEnabled = 1; ! else if( !strcmp( value, "off")) alloc.threadsEnabled = 0; ! return; } ! if( !strcmp( name, "alloc_line")) { ! if( !strcmp( value, "on")) alloc.linenoEnabled = 1; ! else if( !strcmp( value, "off")) alloc.linenoEnabled = 0; ! return; ! } ! if( !strcmp( name, "cpu")) { ! ! if( !strcmp( value, "on")) cpu.turnedOn = 1; ! else if( !strcmp( value, "off")) cpu.turnedOn = 0; ! return; ! } ! if( !strcmp( name, "cpu_method")) { ! ! if( !strcmp( value, "exact")) cpu.sampling = 0; ! else if( !strcmp( value, "sampling")) cpu.sampling = 1; ! return; ! } ! if( !strcmp( name, "cpu_level")) { ! ! if( !strcmp( value, "method")) cpu.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) cpu.level = LEVEL_TRACE; ! return; ! } ! if( !strcmp( name, "cpu_trace_depth")) { ! ! int depth = atoi( value); ! if( depth > 0) { ! ! if( depth > MAX_TRACE) depth = MAX_TRACE; ! cpu.traceDepth = depth; ! } ! return; ! } ! if( !strcmp( name, "cpu_thread")) { ! ! if( !strcmp( value, "on")) cpu.threadsEnabled = 1; ! else if( !strcmp( value, "off")) cpu.threadsEnabled = 0; ! return; ! } ! if( !strcmp( name, "cpu_line")) { ! ! if( !strcmp( value, "on")) cpu.linenoEnabled = 1; ! else if( !strcmp( value, "off")) cpu.linenoEnabled = 0; ! return; } ! if( !strcmp( name, "cpu_calltree")) { ! if( !strcmp( value, "on")) cpu.callTreeEnabled = 1; ! else if( !strcmp( value, "off")) cpu.callTreeEnabled = 0; ! return; ! } ! if( !strcmp( name, "cpu_calltree_line")) { ! if( !strcmp( value, "on")) cpu.callTreeLinenoEnabled = 1; ! else if( !strcmp( value, "off")) cpu.callTreeLinenoEnabled = 0; return; } ! if( !strcmp( name, "mon")) { ! if( !strcmp( value, "on")) mon.turnedOn = 1; ! else if( !strcmp( value, "off")) mon.turnedOn = 0; ! ! return; ! } ! if( !strcmp( name, "mon_level")) { ! ! if( !strcmp( value, "method")) mon.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) mon.level = LEVEL_TRACE; return; } ! if( !strcmp( name, "mon_trace_depth")) { ! int depth = atoi( value); ! ! if( depth > 0) { ! if( depth > MAX_TRACE) depth = MAX_TRACE; ! mon.traceDepth = depth; ! } return; } ! if( !strcmp( name, "mon_thread")) { ! if( !strcmp( value, "on")) mon.threadsEnabled = 1; ! else if( !strcmp( value, "off")) mon.threadsEnabled = 0; ! ! return; ! } ! ! if( !strcmp( name, "mon_line")) { ! if( !strcmp( value, "on")) mon.linenoEnabled = 1; ! else if( !strcmp( value, "off")) mon.linenoEnabled = 0; return; --- 142,278 ---- } ! int Setup::setParamOnOff( const char* name, const char* value) { ! static struct _nv { ! const char* name; ! int* value; ! } nv[] = { { "alloc", &alloc.turnedOn}, ! { "alloc_thread", &alloc.threadsEnabled}, ! { "alloc_line", &alloc.linenoEnabled}, ! { "cpu", &cpu.turnedOn}, ! { "cpu_thread", &cpu.threadsEnabled}, ! { "cpu_line", &cpu.linenoEnabled}, ! { "cpu_calltree", &cpu.callTreeEnabled}, ! { "cpu_calltree_line", &cpu.callTreeLinenoEnabled}, ! { "mon", &mon.turnedOn}, ! { "mon_thread", &mon.threadsEnabled}, ! { "mon_line", &mon.linenoEnabled}, ! { NULL, NULL}}; ! _nv* p = nv; ! while( p->name) { ! if( !strcmp( p->name, name)) { ! if( !strcmp( value, "on")) *p->value = 1; ! else if( !strcmp( value, "off")) *p->value = 0; ! else if( _verbose) ! cout << name ! << ": illegal value, accepted is {on|off}" ! << endl; ! return 1; ! } ! p++; } ! return 0; ! } ! int Setup::setParamDepth( const char* name, const char* value) { ! static struct _nv { ! const char* name; ! int* value; ! } nv[] = { { "alloc_trace_depth", &alloc.traceDepth}, ! { "cpu_trace_depth", &cpu.traceDepth}, ! { "mon_trace_depth", &mon.traceDepth}, ! { NULL, NULL}}; ! _nv* p = nv; ! while( p->name) { ! if( !strcmp( p->name, name)) { ! int depth = atoi( value); ! if( depth < 1 || depth > MAX_TRACE) { ! if( depth > MAX_TRACE) depth = MAX_TRACE; ! else if( depth < 1) depth = 1; ! if( _verbose) ! cout << name ! << ": out of range (1-" << MAX_TRACE ! << "), set to " << depth ! << endl; ! } ! *p->value = depth; ! return 1; ! } ! p++; } ! return 0; ! } ! void Setup::setParameter( const char* name, const char* value) { ! if( setParamOnOff( name, value)) return; ! if( setParamDepth( name, value)) return; ! if( !strcmp( name, "alloc_level")) { ! ! if( !strcmp( value, "object")) alloc.level = LEVEL_OBJECT; ! else if( !strcmp( value, "method")) alloc.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) alloc.level = LEVEL_TRACE; ! else if( _verbose) ! cout << name << ": illegal value, accepted is {object|method|trace}" << endl; return; } ! if( !strcmp( name, "cpu_method")) { ! if( !strcmp( value, "exact")) cpu.sampling = 0; ! else if( !strcmp( value, "sampling")) cpu.sampling = 1; ! else if( _verbose) ! cout << name << ": illegal value, accepted is {exact|sampling}" << endl; return; } ! if( !strcmp( name, "cpu_level")) { ! if( !strcmp( value, "method")) cpu.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) cpu.level = LEVEL_TRACE; ! else if( _verbose) ! cout << name << ": illegal value, accepted is {method|trace}" << endl; return; } ! if( !strcmp( name, "mon_level")) { ! if( !strcmp( value, "method")) mon.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) mon.level = LEVEL_TRACE; ! else if( _verbose) ! cout << name << ": illegal value, accepted is {method|trace}" << endl; return; *************** *** 279,282 **** --- 283,289 ---- if( !strcmp( value, "socket")) com.communType = COMMUN_SOCKET; else if( !strcmp( value, "shmem")) com.communType = COMMUN_SHMEM; + else if( _verbose) + + cout << name << ": illegal value, accepted is {socket|shmem}" << endl; return; *************** *** 286,289 **** --- 293,300 ---- com.hostname = value; + + if( _verbose && !strlen( value)) + cout << name << ": hostname is empty !!!" << endl; + return; } *************** *** 298,301 **** --- 309,321 ---- com.shmemSize = atoi( value); + + if( com.shmemSize < 256) { + + com.shmemSize = 256; + + if( _verbose) + cout << name << ": insufficient size, set to 256 bytes" << endl; + } + return; } *************** *** 304,307 **** --- 324,331 ---- com.shmemId = value; + + if( _verbose && !strlen( com.shmemId)) + cout << name << ": shared memory identifier is empty !!!" << endl; + return; } *************** *** 311,316 **** --- 335,455 ---- if( !strcmp( value, "server")) com.connectMode = 0; else if( !strcmp( value, "client")) com.connectMode = 1; + else if( _verbose) + + cout << name << ": illegal value, accepted is {server|client}" << endl; + + return; + } + + if( !strcmp( name, "verbose")) { + + if( _verbose && strcmp( value, "off") && strcmp( value, "on")) + + cout << name << ": illegal value, accepted is {on|off}" << endl; return; + } + + if( _verbose) + cout << name << ": unknown parameter" << endl; + } + + void Setup::printSumarize() { + + cout << "memory profiling: "; + if( alloc.turnedOn) { + + cout << "enabled" << endl; + + cout << " profiling level: "; + if( alloc.level == LEVEL_OBJECT) cout << "objects" << endl; + else if( alloc.level == LEVEL_METHOD) cout << "objects and methods" << endl; + else { + + cout << "objects, methods and traces" << endl; + cout << " trace depth: " << alloc.traceDepth << endl; + cout << " trace resolution to lines: " + << ((alloc.linenoEnabled) ? "enabled" : "disabled") << endl; + } + + cout << " resolution to threads: " + << ((alloc.threadsEnabled) ? "enabled" : "disabled") << endl; + } + else cout << "disabled" << endl; + + cout << "cpu profiling: "; + if( cpu.turnedOn) { + + cout << "enabled" << endl; + + cout << " profiling method: " << ((cpu.sampling) ? "sampling" : "exact") << endl; + + cout << " profiling level: "; + if( cpu.level == LEVEL_METHOD) cout << "methods" << endl; + else { + + cout << "methods and traces" << endl; + cout << " trace depth: " << cpu.traceDepth << endl; + cout << " trace resolution to lines: " + << ((cpu.linenoEnabled) ? "enabled" : "disabled") << endl; + } + + cout << " resolution to threads: " + << ((cpu.threadsEnabled) ? "enabled" : "disabled") << endl; + + cout << " calltree: "; + if( cpu.callTreeEnabled) { + + cout << "enabled" << endl; + + cout << " calltree node resolution to lines: " + << ((cpu.callTreeLinenoEnabled) ? "enabled" : "disabled") << endl; + } + else cout << "disabled" << endl; + } + else cout << "disabled" << endl; + + cout << "monitor profiling: "; + if( mon.turnedOn) { + + cout << "enabled" << endl; + + cout << " profiling level: "; + if( mon.level == LEVEL_METHOD) cout << "methods" << endl; + else { + + cout << "methods and traces" << endl; + cout << " trace depth: " << mon.traceDepth << endl; + cout << " trace resolution to lines: " + << ((mon.linenoEnabled) ? "enabled" : "disabled") << endl; + } + + cout << " resolution to threads: " + << ((mon.threadsEnabled) ? "enabled" : "disabled") << endl; + } + else cout << "disabled" << endl; + + cout << "communication interface: "; + if( com.communType == COMMUN_SOCKET) { + + cout << "TCP/IP sockets (local and remote)" << endl; + cout << " connection mode (library acts as): "; + if( com.connectMode) { + + cout << "client" << endl; + cout << " hostname of remote server: " << com.hostname << endl; + cout << " port on remote server: " << com.port << endl; + } + else { + + cout << "server" << endl; + cout << " port where library listens for incoming connections: " << com.port << endl; + } + } + else { + + cout << "shared memory (local)" << endl; + cout << " identifier (first 3 chars): " << com.shmemId << endl; + cout << " size (in bytes): " << com.shmemSize << endl; } } Index: setup.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** setup.h 22 Mar 2002 21:22:42 -0000 1.12 --- setup.h 15 Jul 2002 21:55:13 -0000 1.13 *************** *** 208,218 **** ** @param options command-line options */ ! Setup( char* options = NULL); /** Sets parameters according to command line options. ** ! ** @param options command line options string */ ! void processOptions( char* options); private: --- 208,218 ---- ** @param options command-line options */ ! Setup( const char* options = NULL); /** Sets parameters according to command line options. ** ! ** @param options command line options string */ ! void processOptions( const char* options); private: *************** *** 226,233 **** /** Sets parameter. ** ! ** @param name parameter name ! ** @param value parameter value */ ! void setParameter( char* name, char* value); }; --- 226,271 ---- /** Sets parameter. ** ! ** @param name parameter name ! ** @param value parameter value ! ** ! ** @see setParamOnOff(), setParamDepth() */ ! ! void setParameter( const char* name, const char* value); ! ! /** Sets an on/off parameter. It only processes ! ** parameters of this type. ! ** ! ** @param name parameter name ! ** @param value parameter value (on/off) ! ** ! ** @return 1 (okay, processed); ! ** 0 (bad value, not an on/off-parameter) ! ** ! ** @see setParameter() */ ! ! int setParamOnOff( const char* name, const char* value); ! ! /** Sets a trace depth parameter. It only processes ! ** parameters of this type. ! ** ! ** @param name parameter name ! ** @param value parameter value (positive integer) ! ** ! ** @return 1 (okay, processed); ! ** 0 (bad value, not a trace depth) ! ** ! ** @see setParameter() */ ! ! int setParamDepth( const char* name, const char* value); ! ! /** Print sumarizing information. This method prints ! ** the setup sumarizations. */ ! ! void printSumarize(); ! ! private: ! /// verbose mode is on(1)/off(0) ! int _verbose; }; |
From: Marek P. <ma...@us...> - 2002-07-15 21:55:16
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv25109/src/prof Modified Files: prof.cpp prof.h Log Message: verbose messages added new "verbose={on|off}" command-line argument Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** prof.cpp 15 Apr 2002 21:04:18 -0000 1.29 --- prof.cpp 15 Jul 2002 21:55:12 -0000 1.30 *************** *** 123,127 **** Prof* Prof::_prof = NULL; ! Prof* Prof::create( char* options, JVMPI_Interface* jvmpi) { _prof = new Prof( *(new Setup( options)), jvmpi); --- 123,127 ---- Prof* Prof::_prof = NULL; ! Prof* Prof::create( const char* options, JVMPI_Interface* jvmpi) { _prof = new Prof( *(new Setup( options)), jvmpi); Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** prof.h 15 Apr 2002 21:04:18 -0000 1.44 --- prof.h 15 Jul 2002 21:55:12 -0000 1.45 *************** *** 1110,1114 **** ** @return pointer to newly created object */ ! static Prof* create( char* options, JVMPI_Interface* jvmpi); /** Destroys profiler Prof object. It is called --- 1110,1114 ---- ** @return pointer to newly created object */ ! static Prof* create( const char* options, JVMPI_Interface* jvmpi); /** Destroys profiler Prof object. It is called |
From: Pavel V. <va...@us...> - 2002-07-15 21:48:09
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv23495 Modified Files: VirtualMachineImpl.java Log Message: method createSnapshot() accepts configuration class Index: VirtualMachineImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/VirtualMachineImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** VirtualMachineImpl.java 4 Jul 2002 17:58:20 -0000 1.7 --- VirtualMachineImpl.java 15 Jul 2002 21:48:06 -0000 1.8 *************** *** 104,108 **** } ! public Snapshot createSnapshot(int filterMask) { return createSnapshot(); } --- 104,109 ---- } ! public Snapshot createSnapshot(Snapshot.Configuration conf) { ! //PENDING: TO PASS CONFIGURATION return createSnapshot(); } *************** *** 295,298 **** --- 296,302 ---- /* * $Log$ + * Revision 1.8 2002/07/15 21:48:06 vachis + * method createSnapshot() accepts configuration class + * * Revision 1.7 2002/07/04 17:58:20 stolis * Implements VirtualMachineRef instead of VirtualMachine. |