From: Marek P. <ma...@us...> - 2002-04-15 21:04:26
|
Update of /cvsroot/javaprofiler/library/demo/08 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/08 Modified Files: README Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/08/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** README 8 Apr 2002 23:30:01 -0000 1.1 --- README 15 Apr 2002 21:04:17 -0000 1.2 *************** *** 1 **** ! Test of objects. --- 1,5 ---- ! Test of objects. This example is a bit strange and slow, because of different ! tests of numbers of objects. So therefore we use shared memory communication ! for that to be as fast as possible. See a manual for how to switch ! communication throught shared memory on. ! Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/08/Test.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Test.java 8 Apr 2002 23:30:01 -0000 1.1 --- Test.java 15 Apr 2002 21:04:17 -0000 1.2 *************** *** 49,56 **** // stay for a server (so dynamic library must stay for a client) ! iprof = new IProf(); ! iprof.run(); try { // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, --- 49,60 ---- // stay for a server (so dynamic library must stay for a client) ! iprof = new IProf( new CommunSetupShMem()); try { + + iprof.run(); + + while( !iprof.isShutdowned()) Thread.sleep( 1000); + // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, *************** *** 62,67 **** --- 66,90 ---- System.out.println( "object: " + sid.objId); + + if( ((IProf.sObjectInfo)iprof.getInfo( sid.infoId, IProf.OBJECT_INFO)).isArray == IProf.JVMPI_NORMAL_OBJECT) + System.out.println(((IProf.sClassInfo)iprof.getInfo( ((IProf.sObjectInfo)iprof.getInfo( sid.infoId, IProf.OBJECT_INFO)).classObjId, IProf.CLASS_INFO)).className); + System.out.println( "totalnum: " + sid.alloc.allocNumInstancesTotal); System.out.println( "livenum: " + sid.alloc.allocNumInstancesLive); + + LinkedList list = iprof.getAll( sid.objId, IProf.ALLOC_OBJECT_METHODS); + System.out.println( "#methods: " + list.size()); + + if( list.size() > sid.alloc.allocNumInstancesTotal) System.out.println( "ERROR"); + + ListIterator iterator2 = list.listIterator(); + while( iterator2.hasNext()) { + + IProf.sID sid2 = (IProf.sID)iterator2.next(); + System.out.println( "mtotal=" + sid2.alloc.allocNumInstancesTotal); + sid.alloc.allocNumInstancesTotal -= sid2.alloc.allocNumInstancesTotal; + } + + if( sid.alloc.allocNumInstancesTotal != 0) System.out.println( "ERROR2"); System.out.println(); |