From: Lukas P. <pe...@us...> - 2002-04-21 19:43:57
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv32693 Modified Files: AllocThreadMethodR.java AllocTraceR.java AllocTypeThreadMethodR.java AllocTypeThreadR.java AllocTypeTraceR.java ImageR.java ThreadR.java Added Files: AllocThreadTraceR.java AllocTypeThreadTraceR.java Log Message: added alloc classes --- NEW FILE: AllocThreadTraceR.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.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.Thread; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocThreadTrace * @author Lukas Petru */ public class AllocThreadTraceR extends DataR implements AllocThreadTrace { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; // roots to which this object is linked private ThreadR thread; private AllocTraceR location; // parents private AllocThreadMethodR method; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeThreadTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeThreadTraces=Collections.unmodifiableList( allocTypeThreadTraces); /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocThreadTraceR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots thread=image.resolveThread(threadId); location=image.resolveAllocTrace(locationId); // resolve parent Integer methodId=new Integer(sid.parentUpObjId); if (image.containsId(methodId)) method=(AllocThreadMethodR) image.getObject(methodId); else { method=new AllocThreadMethodR(methodId, image); image.putObject(methodId, method); } isReady=true; // add to parents' lists thread.addAllocThreadTrace(this); location.addAllocThreadTrace(this); method.addAllocThreadTrace(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocThreadTraceR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return child Lists public void refreshAllocTypeThreadTraces() { image.extractMultiRoot(this, IProf.ALLOC_THREAD_METHOD_TRACE_OBJECTS, image.allocTypeThreadTraceFactory); } public List getAllocTypeThreadTraces() { if ( image.getAlwaysRefresh() ) refreshAllocTypeThreadTraces(); return roAllocTypeThreadTraces; } // ---------- return parents public AllocThreadMethod getParentAllocThreadMethod() { needConstructed(); return method; } public Thread getParentThread() { needConstructed(); return thread; } public AllocTrace getParentAllocTrace() { needConstructed(); return location; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { return null; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { needConstructed(); return thread; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package void addAllocTypeThreadTrace(AllocTypeThreadTrace o) { allocTypeThreadTraces.add(o); } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // link to parents Integer methodId=new Integer(parents.parentUpObjId); if (image.containsId(methodId)) method=(AllocThreadMethodR) image.getObject(methodId); else { method=new AllocThreadMethodR(methodId, image); image.putObject(methodId, method); } // link to roots location=image.resolveAllocTrace(new Integer(parents. parentLeftObjId)); thread=method.getThread(); isReady=true; // add to parents' and root lists thread.addAllocThreadTrace(this); location.addAllocThreadTrace(this); method.addAllocThreadTrace(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getThread() + "-" + getLocation(); } } --- NEW FILE: AllocTypeThreadTraceR.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.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.Thread; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTypeThreadTrace * @author Lukas Petru */ public class AllocTypeThreadTraceR extends DataR implements AllocTypeThreadTrace { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; // roots to which this object is linked private AllocTypeR type; private ThreadR thread; private AllocTraceR location; // parents private AllocTypeTraceR typeTrace; private AllocTypeThreadMethodR method; private AllocThreadTraceR threadTrace; private AllocTypeThreadR typeThread; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadTraceR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots type=image.resolveAllocType(typeId); thread=image.resolveThread(threadId); location=image.resolveAllocTrace(locationId); // resolve parents Integer methodId=new Integer(sid.parentUpObjId); if (image.containsId(methodId)) method=(AllocTypeThreadMethodR) image.getObject(methodId); else { method=new AllocTypeThreadMethodR(methodId, image); image.putObject(methodId, method); } Integer typeTraceId=new Integer(sid.parentLeftObjId); if (image.containsId(typeTraceId)) typeTrace=(AllocTypeTraceR) image.getObject(typeTraceId); else { typeTrace=new AllocTypeTraceR(typeTraceId, image); image.putObject(typeTraceId, typeTrace); } Integer threadTraceId=new Integer(sid.parentRightObjId); if (image.containsId(threadTraceId)) threadTrace=(AllocThreadTraceR) image.getObject(threadTraceId); else { threadTrace=new AllocThreadTraceR(threadTraceId, image); image.putObject(threadTraceId, threadTrace); } typeThread=(AllocTypeThreadR) method.getParentAllocTypeThread(); isReady=true; // add to parents' lists method.addAllocTypeThreadTrace(this); typeTrace.addAllocTypeThreadTrace(this); threadTrace.addAllocTypeThreadTrace(this); typeThread.addAllocTypeThreadTrace(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadTraceR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return child Lists // ---------- return parents public AllocTypeThreadMethod getParentAllocTypeThreadMethod() { needConstructed(); return method; } public AllocTypeTrace getParentAllocTypeTrace() { needConstructed(); return typeTrace; } public AllocThreadTrace getParentAllocThreadTrace() { needConstructed(); return threadTrace; } public AllocTypeThread getParentAllocTypeThread() { needConstructed(); return typeThread; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { needConstructed(); return type; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { needConstructed(); return thread; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // link to parents Integer methodId=new Integer(parents.parentUpObjId); if (image.containsId(methodId)) method=(AllocTypeThreadMethodR) image.getObject(methodId); else { method=new AllocTypeThreadMethodR(methodId, image); image.putObject(methodId, method); } Integer typeTraceId=new Integer(parents.parentLeftObjId); if (image.containsId(typeTraceId)) typeTrace=(AllocTypeTraceR) image.getObject(typeTraceId); else { typeTrace=new AllocTypeTraceR(typeTraceId, image); image.putObject(typeTraceId, typeTrace); } Integer threadTraceId=new Integer(parents.parentRightObjId); if (image.containsId(threadTraceId)) threadTrace=(AllocThreadTraceR) image.getObject(threadTraceId); else { threadTrace=new AllocThreadTraceR(threadTraceId, image); image.putObject(threadTraceId, threadTrace); } typeThread=(AllocTypeThreadR) method.getParentAllocTypeThread(); // link to roots type=method.getAllocType(); thread=method.getThread(); location=(AllocTraceR) typeTrace.getLocation(); isReady=true; // add to parents' and root lists method.addAllocTypeThreadTrace(this); typeTrace.addAllocTypeThreadTrace(this); threadTrace.addAllocTypeThreadTrace(this); typeThread.addAllocTypeThreadTrace(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getAllocType() + "-" + getThread() + "-" + getLocation(); } } Index: AllocThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocThreadMethodR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocThreadMethodR.java 15 Apr 2002 19:46:03 -0000 1.1 --- AllocThreadMethodR.java 21 Apr 2002 19:43:48 -0000 1.2 *************** *** 69,76 **** --- 69,79 ---- // lists for children private final List allocTypeThreadMethods=new ArrayList(0); + private final List allocThreadTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeThreadMethods=Collections.unmodifiableList( allocTypeThreadMethods); + private final List roAllocThreadTraces=Collections.unmodifiableList( + allocThreadTraces); /** Constructs multi-rooted object *************** *** 111,117 **** // ---------- return child Lists public List getAllocThreadTraces() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 114,126 ---- // ---------- return child Lists + public void refreshAllocThreadTraces() { + image.extractMultiRoot(this, IProf.ALLOC_THREAD_METHOD_TRACES, + image.allocThreadTraceFactory); + } + public List getAllocThreadTraces() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocThreadTraces(); ! return roAllocThreadTraces; } *************** *** 205,208 **** --- 214,221 ---- void addAllocTypeThreadMethod(AllocTypeThreadMethod o) { allocTypeThreadMethods.add(o); + } + + void addAllocThreadTrace(AllocThreadTrace o) { + allocThreadTraces.add(o); } Index: AllocTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTraceR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTraceR.java 10 Apr 2002 16:01:15 -0000 1.1 --- AllocTraceR.java 21 Apr 2002 19:43:48 -0000 1.2 *************** *** 68,75 **** --- 68,78 ---- // lists for children private final List allocTypeTraces=new ArrayList(0); + private final List allocThreadTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeTraces=Collections.unmodifiableList( allocTypeTraces); + private final List roAllocThreadTraces=Collections.unmodifiableList( + allocThreadTraces); /** Constructs new object with info. *************** *** 108,113 **** // children lists getter methods public List getAllocThreadTraces() { ! return Collections.EMPTY_LIST; } --- 111,123 ---- // children lists getter methods + public void refreshAllocThreadTraces() { + image.extractMultiRoot(this, IProf.ALLOC_METHOD_TRACE_THREADS, + image.allocThreadTraceFactory); + } + public List getAllocThreadTraces() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocThreadTraces(); ! return roAllocThreadTraces; } *************** *** 175,178 **** --- 185,192 ---- void addAllocTypeTrace(AllocTypeTrace o) { allocTypeTraces.add(o); + } + + void addAllocThreadTrace(AllocThreadTrace o) { + allocThreadTraces.add(o); } Index: AllocTypeThreadMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadMethodR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTypeThreadMethodR.java 15 Apr 2002 19:46:05 -0000 1.1 --- AllocTypeThreadMethodR.java 21 Apr 2002 19:43:48 -0000 1.2 *************** *** 72,75 **** --- 72,82 ---- private long sizeTotalInstances; + // lists for children + private final List allocTypeThreadTraces=new ArrayList(0); + + // unmodifiable variants of lists for children + private final List roAllocTypeThreadTraces=Collections.unmodifiableList( + allocTypeThreadTraces); + /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should *************** *** 132,138 **** // ---------- return child Lists public List getAllocTypeThreadTraces() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 139,151 ---- // ---------- return child Lists + public void refreshAllocTypeThreadTraces() { + image.extractMultiRoot(this, IProf.ALLOC_THREAD_OBJECT_METHOD_TRACES, + image.allocTypeThreadTraceFactory); + } + public List getAllocTypeThreadTraces() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocTypeThreadTraces(); ! return roAllocTypeThreadTraces; } *************** *** 219,222 **** --- 232,239 ---- // ---------- private / package + void addAllocTypeThreadTrace(AllocTypeThreadTrace o) { + allocTypeThreadTraces.add(o); + } + /** Determines whether refresh should be done and does, if so. */ Index: AllocTypeThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadR.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** AllocTypeThreadR.java 15 Apr 2002 19:46:06 -0000 1.2 --- AllocTypeThreadR.java 21 Apr 2002 19:43:48 -0000 1.3 *************** *** 162,166 **** public void refreshAllocTypeThreadTraces() { ! //PENDING } --- 162,172 ---- public void refreshAllocTypeThreadTraces() { ! if (! image.getAlwaysRefresh()) ! refreshAllocTypeThreadMethods(); ! Iterator it=getAllocTypeThreadMethods().iterator(); ! while (it.hasNext()) { ! AllocTypeThreadMethodR o=(AllocTypeThreadMethodR) it.next(); ! o.refreshAllocTypeThreadTraces(); ! } } Index: AllocTypeTraceR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeTraceR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTypeTraceR.java 10 Apr 2002 16:01:15 -0000 1.1 --- AllocTypeTraceR.java 21 Apr 2002 19:43:48 -0000 1.2 *************** *** 52,56 **** /** Object identification. */ ! private Integer objId; // roots to which this object is linked --- 52,56 ---- /** Object identification. */ ! private final Integer objId; // roots to which this object is linked *************** *** 67,70 **** --- 67,77 ---- private long sizeTotalInstances; + // lists for children + private final List allocTypeThreadTraces=new ArrayList(0); + + // unmodifiable variants of lists for children + private final List roAllocTypeThreadTraces=Collections.unmodifiableList( + allocTypeThreadTraces); + /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should *************** *** 112,118 **** // ---------- return child Lists public List getAllocTypeThreadTraces() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 119,131 ---- // ---------- return child Lists + public void refreshAllocTypeThreadTraces() { + image.extractMultiRoot(this, IProf.ALLOC_OBJECT_METHOD_TRACE_THREADS, + image.allocTypeThreadTraceFactory); + } + public List getAllocTypeThreadTraces() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocTypeThreadTraces(); ! return roAllocTypeThreadTraces; } *************** *** 198,201 **** --- 211,218 ---- // ---------- private / package + void addAllocTypeThreadTrace(AllocTypeThreadTrace o) { + allocTypeThreadTraces.add(o); + } + /** Determines whether refresh should be done and does, if so. */ *************** *** 217,222 **** if (image.containsId(methodId)) method=(AllocTypeMethodR) image.getObject(methodId); ! else method=new AllocTypeMethodR(methodId, image); location=image.resolveAllocTrace(new Integer(parents. parentLeftObjId)); --- 234,241 ---- if (image.containsId(methodId)) method=(AllocTypeMethodR) image.getObject(methodId); ! else { method=new AllocTypeMethodR(methodId, image); + image.putObject(methodId, method); + } location=image.resolveAllocTrace(new Integer(parents. parentLeftObjId)); Index: ImageR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ImageR.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ImageR.java 15 Apr 2002 19:46:06 -0000 1.2 --- ImageR.java 21 Apr 2002 19:43:48 -0000 1.3 *************** *** 110,113 **** --- 110,115 ---- final Constructor allocThreadMethodFactory; final Constructor allocTypeThreadMethodFactory; + final Constructor allocThreadTraceFactory; + final Constructor allocTypeThreadTraceFactory; Set getAllFlags=new HashSet(); *************** *** 195,212 **** this.getClass() }; allocTypeMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeMethodR") ! .getDeclaredConstructor(mrParameterTypes); allocTypeTraceFactory=java.lang.Class.forName( "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeTraceR") .getDeclaredConstructor(mrParameterTypes); allocTypeThreadFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadR") ! .getDeclaredConstructor(mrParameterTypes); allocThreadMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocThreadMethodR") ! .getDeclaredConstructor(mrParameterTypes); allocTypeThreadMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadMethodR") ! .getDeclaredConstructor(mrParameterTypes); } catch (ClassNotFoundException e) { throw new RuntimeException(e); --- 197,220 ---- this.getClass() }; allocTypeMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeMethodR" ! ).getDeclaredConstructor(mrParameterTypes); allocTypeTraceFactory=java.lang.Class.forName( "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeTraceR") .getDeclaredConstructor(mrParameterTypes); allocTypeThreadFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadR" ! ).getDeclaredConstructor(mrParameterTypes); allocThreadMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocThreadMethodR" ! ).getDeclaredConstructor(mrParameterTypes); allocTypeThreadMethodFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadMethodR" ! ).getDeclaredConstructor(mrParameterTypes); ! allocThreadTraceFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocThreadTraceR" ! ).getDeclaredConstructor(mrParameterTypes); ! allocTypeThreadTraceFactory=java.lang.Class.forName( ! "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadTraceR" ! ).getDeclaredConstructor(mrParameterTypes); } catch (ClassNotFoundException e) { throw new RuntimeException(e); *************** *** 329,332 **** --- 337,344 ---- private final String LOCATION_KEY="location"; + /** Tells which root is extracted when going along given direction. + * @return One of <code>TYPE_KEY</code>, <code>THREAD_KEY</code>, + * <code>LOCATION_KEY</code>. + */ private String getVaryKey(int direction) { switch (direction) { *************** *** 342,345 **** --- 354,362 ---- case IProf.ALLOC_THREAD_OBJECT_METHODS: return LOCATION_KEY; case IProf.ALLOC_THREAD_METHOD_OBJECTS: return TYPE_KEY; + case IProf.ALLOC_THREAD_METHOD_TRACES: return LOCATION_KEY; + case IProf.ALLOC_METHOD_TRACE_THREADS: return THREAD_KEY; + case IProf.ALLOC_THREAD_OBJECT_METHOD_TRACES: return LOCATION_KEY; + case IProf.ALLOC_OBJECT_METHOD_TRACE_THREADS: return THREAD_KEY; + case IProf.ALLOC_THREAD_METHOD_TRACE_OBJECTS: return TYPE_KEY; default: throw new RuntimeException("No branch in switch!"); } *************** *** 720,729 **** optionalArg, boolean clearFlag) throws COMMUN_Exception, BAD_OBJ_ID_Exception, BAD_COMMAND_Exception, UNKNOWN_Exception { ! if ( getAllFlags.add(new Long(direction << 32 + parent)) ) return iprof.getAllThruIterator(parent, direction, sameOutputObject, includeInfo, optionalArg, clearFlag); ! else return iprof.getChangedThruIterator(parent, direction, sameOutputObject, includeInfo, optionalArg, clearFlag); } --- 737,747 ---- optionalArg, boolean clearFlag) throws COMMUN_Exception, BAD_OBJ_ID_Exception, BAD_COMMAND_Exception, UNKNOWN_Exception { ! if ( getAllFlags.add(new Long(direction << 32 + parent)) ) { return iprof.getAllThruIterator(parent, direction, sameOutputObject, includeInfo, optionalArg, clearFlag); ! } else { return iprof.getChangedThruIterator(parent, direction, sameOutputObject, includeInfo, optionalArg, clearFlag); + } } Index: ThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ThreadR.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ThreadR.java 15 Apr 2002 19:46:06 -0000 1.2 --- ThreadR.java 21 Apr 2002 19:43:48 -0000 1.3 *************** *** 79,82 **** --- 79,83 ---- private final List allocTypeThreads=new ArrayList(0); private final List allocThreadMethods=new ArrayList(0); + private final List allocThreadTraces=new ArrayList(0); // unmodifiable variants of lists for children *************** *** 85,88 **** --- 86,91 ---- private final List roAllocThreadMethods=Collections.unmodifiableList( allocThreadMethods); + private final List roAllocThreadTraces=Collections.unmodifiableList( + allocThreadTraces); /** Constructs new object with info. *************** *** 147,153 **** } public List getAllocThreadTraces() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 150,167 ---- } + public void refreshAllocThreadTraces() { + if (! image.getAlwaysRefresh()) + refreshAllocThreadMethods(); + Iterator it=getAllocThreadMethods().iterator(); + while (it.hasNext()) { + AllocThreadMethodR o=(AllocThreadMethodR) it.next(); + o.refreshAllocThreadTraces(); + } + } + public List getAllocThreadTraces() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocThreadTraces(); ! return roAllocThreadTraces; } *************** *** 265,268 **** --- 279,286 ---- void addAllocThreadMethod(AllocThreadMethod o) { allocThreadMethods.add(o); + } + + void addAllocThreadTrace(AllocThreadTrace o) { + allocThreadTraces.add(o); } |