From: Pavel V. <va...@us...> - 2002-07-22 23:39:51
|
Update of /cvsroot/javaprofiler/test/module In directory usw-pr-cvs1:/tmp/cvs-serv16670 Modified Files: TestAllocHistView.java Log Message: realtime is working Index: TestAllocHistView.java =================================================================== RCS file: /cvsroot/javaprofiler/test/module/TestAllocHistView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** TestAllocHistView.java 22 Jul 2002 17:52:48 -0000 1.2 --- TestAllocHistView.java 22 Jul 2002 23:39:48 -0000 1.3 *************** *** 25,29 **** --- 25,31 ---- import javax.swing.JFrame; import javax.swing.JScrollPane; + import java.awt.*; + import java.awt.event.*; import net.sourceforge.javaprofiler.module.views.*; *************** *** 36,39 **** --- 38,42 ---- */ public class TestAllocHistView { + VirtualMachineRef vm; VirtualMachineImageRef image; JFrame frame; *************** *** 44,51 **** public TestAllocHistView() { try { ! VirtualMachineRef vm = connect(); ! ! image = vm.getRealtimeImage(); ((net.sourceforge.javaprofiler.jpiimpl.realtime.ImageR) image). refreshTypes(); --- 47,53 ---- public TestAllocHistView() { try { ! vm = connect(); + image = vm.realtimeImage(); ((net.sourceforge.javaprofiler.jpiimpl.realtime.ImageR) image). refreshTypes(); *************** *** 55,59 **** frame=new JFrame("Main"); ! frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); JTable table = new AllocHistogramTable( --- 57,67 ---- frame=new JFrame("Main"); ! frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); ! frame.addWindowListener(new WindowAdapter() { ! public void windowClosing(WindowEvent e) { ! vm.dispose(); //necessary cleanup especialy for shmem conectors ! System.exit(0); ! } ! }); JTable table = new AllocHistogramTable( *************** *** 75,89 **** private class RefreshThread extends Thread { ! java.util.List types; public RefreshThread() { types = image.getTypes(); } ! public void run () { ! ((net.sourceforge.javaprofiler.jpiimpl.realtime.ImageR) image). ! refreshTypes(); ! try { ! sleep(1000); ! } ! catch ( InterruptedException e ) { } } --- 83,103 ---- private class RefreshThread extends Thread { ! public boolean stop; ! ! private java.util.List types; ! public RefreshThread() { types = image.getTypes(); + stop = false; } ! public void run() { ! while( !stop ) { ! ((net.sourceforge.javaprofiler.jpiimpl.realtime.ImageR) image). ! refreshTypes(); ! try { ! sleep(500); ! } ! catch ( InterruptedException e ) { ! } } } |