From: Marek P. <ma...@us...> - 2002-04-08 23:30:06
|
Update of /cvsroot/javaprofiler/library/demo/08 In directory usw-pr-cvs1:/tmp/cvs-serv8146/demo/08 Added Files: Makefile Makefile.mak Makefile.rules README Test.java dir.info Log Message: fixes --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- Test.o \ Test.obj: $(JAVAC) $(JAVACFLAGS) Test.java --- NEW FILE: README --- Test of objects. --- NEW FILE: Test.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.lang.*; import java.util.*; import net.sourceforge.javaprofiler.jpiimpl.commun.*; public class Test { // communication interface private IProf iprof = null; public void runTest() { // initialize and start communication // we use socket communication where Java module will // 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, IProf.OBJECT_TYPES, true); while( iterator.hasNext()) { IProf.sID sid = (IProf.sID)iterator.next(); System.out.println( "object: " + sid.objId); System.out.println( "totalnum: " + sid.alloc.allocNumInstancesTotal); System.out.println( "livenum: " + sid.alloc.allocNumInstancesLive); System.out.println(); } // now, i don't want anything else, // so I shutdown profiled JVM definitely iprof.shutdown(); } catch( Exception e) { System.err.println( "an error occurred, exception:"); System.err.println( e.getClass().getName()); } // communication must be stopped even if an error occurred ! iprof.stop(); iprof = null; } public static void main( String[] arg) { // let's run the test (new Test()).runTest(); } }; --- NEW FILE: dir.info --- FILES = Test CLEAN_FILES = *.class |