From: Pavel V. <va...@us...> - 2002-05-07 21:11:41
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data In directory usw-pr-cvs1:/tmp/cvs-serv27134 Modified Files: AllocTraceData.java CallTreeData.java ClassData.java CPUTraceData.java MonTraceData.java SnapshotImpl.java ThreadData.java Log Message: fix creation of fields, frames CallTree new api Index: AllocTraceData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/AllocTraceData.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** AllocTraceData.java 6 May 2002 17:32:13 -0000 1.16 --- AllocTraceData.java 7 May 2002 21:11:38 -0000 1.17 *************** *** 34,39 **** implements AllocTraceRef { // private data accessible via getter methods ! private final List frames=new ArrayList(0); ! private final List roFrames=Collections.unmodifiableList(frames); --- 34,39 ---- implements AllocTraceRef { // private data accessible via getter methods ! private final List frames; ! private final List roFrames; *************** *** 58,64 **** AllocTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames.add(frames); ! //FIXME write the constructor, that takes frames from info ! //pending ??assert mehtod == frames.get(0) } --- 58,63 ---- AllocTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames = frames; ! roFrames=Collections.unmodifiableList(frames); } *************** *** 68,73 **** * @param sid data returned by communication layer * @param method allocation data for this method. ! * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. */ AllocTraceData( IProf.sID sid, MethodData method, List frames ) { --- 67,73 ---- * @param sid data returned by communication layer * @param method allocation data for this method. ! * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. Constructor takes this list, ! * it doesn't make a copy of the list. */ AllocTraceData( IProf.sID sid, MethodData method, List frames ) { *************** *** 207,210 **** --- 207,214 ---- /* * $Log$ + * Revision 1.17 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.16 2002/05/06 17:32:13 vachis * new api implemention Index: CallTreeData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/CallTreeData.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** CallTreeData.java 6 May 2002 17:32:13 -0000 1.4 --- CallTreeData.java 7 May 2002 21:11:38 -0000 1.5 *************** *** 29,35 **** /** Call tree item of profiled application. Items are connected in a tree-like * graph structure. ! * @author Lukas Petru */ ! public final class CallTreeData implements Serializable { /** time spent in the method (including sub-calls) */ private long cumulativeTime; --- 29,35 ---- /** Call tree item of profiled application. Items are connected in a tree-like * graph structure. ! * @author Lukas Petru, Pavel Vacha */ ! public final class CallTreeData implements Serializable, CallTreeRef { /** time spent in the method (including sub-calls) */ private long cumulativeTime; *************** *** 38,47 **** /** time spent in the method (excluding sub-calls) */ private long pureTime; ! /** method of this item */ ! private MethodData method; /** methods called by this method * (list of sCallTree objects, can be null) */ ! private List children; /** parent item (method from which current method was called) */ private CallTreeData parent; --- 38,48 ---- /** time spent in the method (excluding sub-calls) */ private long pureTime; ! /** frame of this item */ ! private FrameData frame; /** methods called by this method * (list of sCallTree objects, can be null) */ ! private List children = new ArrayList(0); ! private List roChildren = Collections.unmodifiableList( children ); /** parent item (method from which current method was called) */ private CallTreeData parent; *************** *** 57,67 **** */ CallTreeData( CallTreeData caller, MethodData aMethod, ! long aCumulativeTime, long aHits, long aPureTime ) { parent = caller; ! method = aMethod; cumulativeTime = aCumulativeTime; hits = aHits; pureTime = aPureTime; - children = Collections.EMPTY_LIST; if (parent != null) parent.addChild(this); --- 58,68 ---- */ CallTreeData( CallTreeData caller, MethodData aMethod, ! long aCumulativeTime, long aHits, long aPureTime, int lineno ) { parent = caller; ! frame = new FrameData( lineno, aMethod, ! (parent != null) ? parent.frame : null ); cumulativeTime = aCumulativeTime; hits = aHits; pureTime = aPureTime; if (parent != null) parent.addChild(this); *************** *** 76,80 **** IProf.sCallTree aData ) { this(caller, aMethod, aData.cumulativeTime, aData.hits, ! aData.pureTime); } --- 77,81 ---- IProf.sCallTree aData ) { this(caller, aMethod, aData.cumulativeTime, aData.hits, ! aData.pureTime, aData.lineno ); } *************** *** 82,126 **** */ private void addChild( CallTreeData child ) { - if (children == Collections.EMPTY_LIST) - children = new LinkedList(); children.add(child); ! } ! /** Returns method of this item. */ ! public MethodData getMethod() { ! return method; } /** Returns parent of this item in the tree. */ ! public CallTreeData getParent() { return parent; } /** Returns cumulative time. */ ! public long getCumulativeTime() { return cumulativeTime; } /** Returns hit count. */ ! public long getHits() { return hits; } /** returns pure time. */ ! public long getPureTime() { return pureTime; } } /* * $Log$ * Revision 1.4 2002/05/06 17:32:13 vachis * new api implemention - * - * Revision 1.3 2002/03/11 19:13:20 vachis - * coding style - * - * Revision 1.2 2002/03/08 10:39:53 petrul - * automatically add child to parent's list * * Revision 1.1 2002/03/07 10:36:13 petrul --- 83,147 ---- */ private void addChild( CallTreeData child ) { children.add(child); ! } ! ! // -------------- info for package ! ! /** Returns parent of this item in the tree. */ ! CallTreeData getParentData() { ! return parent; ! } ! ! // -------------- info getter methods ! /** Returns method of this item. */ ! public FrameRef getFrame() { ! return frame; } /** Returns parent of this item in the tree. */ ! public CallTreeRef getParent() { return parent; } /** Returns cumulative time. */ ! public long getCPUCumulativeTime() { return cumulativeTime; } /** Returns hit count. */ ! public long getCPUHitsCount() { return hits; } /** returns pure time. */ ! public long getCPUPureTime() { return pureTime; } + + // -------------- children lists getter methods + + /** Returns unmodifiable list of children. + * Roughly it returns list of methods called from this methods. + * Exactly objects are again <code>CallTreeRefs</code> and don't + * include methods, but frames. The {@link FrameRef} is composed from method + * and line number where this method was called from. + * + * @return unmodifibale <code>List</code> of {@link CallTreeRef} objects. + */ + public List getChildren() { + return roChildren; + } + } /* * $Log$ + * Revision 1.5 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.4 2002/05/06 17:32:13 vachis * new api implemention * * Revision 1.1 2002/03/07 10:36:13 petrul Index: ClassData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/ClassData.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** ClassData.java 6 May 2002 17:32:13 -0000 1.11 --- ClassData.java 7 May 2002 21:11:38 -0000 1.12 *************** *** 112,116 **** * @param fields field defined in this class. */ ! void addFields(FieldData field) { fields.add( field ); } --- 112,116 ---- * @param fields field defined in this class. */ ! void addField(FieldData field) { fields.add( field ); } *************** *** 191,194 **** --- 191,198 ---- /* * $Log$ + * Revision 1.12 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.11 2002/05/06 17:32:13 vachis * new api implemention Index: CPUTraceData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/CPUTraceData.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** CPUTraceData.java 6 May 2002 17:32:13 -0000 1.10 --- CPUTraceData.java 7 May 2002 21:11:38 -0000 1.11 *************** *** 34,39 **** implements CPUTraceRef { // private data accessible via getter methods ! private final List frames=new ArrayList(0); ! private final List roFrames=Collections.unmodifiableList(frames); // lists for children --- 34,39 ---- implements CPUTraceRef { // private data accessible via getter methods ! private final List frames; ! private final List roFrames; // lists for children *************** *** 53,63 **** * @param method profiling data for this method. * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. */ CPUTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames.add(frames); ! //FIXME write the constructor, that takes frames from info ! //pending ??assert mehtod == frames.get(0) } --- 53,63 ---- * @param method profiling data for this method. * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. Constructor takes this list, ! * it doesn't make a copy of the list. */ CPUTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames = frames; ! roFrames=Collections.unmodifiableList(frames); } *************** *** 171,174 **** --- 171,178 ---- /* * $Log$ + * Revision 1.11 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.10 2002/05/06 17:32:13 vachis * new api implemention Index: MonTraceData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/MonTraceData.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** MonTraceData.java 6 May 2002 17:32:13 -0000 1.7 --- MonTraceData.java 7 May 2002 21:11:38 -0000 1.8 *************** *** 35,40 **** implements MonTraceRef { // private data accessible via getter methods ! private final List frames=new ArrayList(0); ! private final List roFrames=Collections.unmodifiableList(frames); // lists for children --- 35,40 ---- implements MonTraceRef { // private data accessible via getter methods ! private final List frames; ! private final List roFrames; // lists for children *************** *** 54,64 **** * @param method profiling data for this method. * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. */ MonTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames.add(frames); ! //FIXME write the constructor, that takes frames from info ! //pending ??assert mehtod == frames.get(0) } --- 54,64 ---- * @param method profiling data for this method. * @param frames frames that make up this trace. It should be ! * <code>List</code> of {@link FrameData} objects. Constructor takes this list, ! * it doesn't make a copy of the list. */ MonTraceData(Integer ID, MethodData method, List frames) { super(ID); ! this.frames = frames; ! roFrames=Collections.unmodifiableList(frames); } *************** *** 171,174 **** --- 171,178 ---- /* * $Log$ + * Revision 1.8 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.7 2002/05/06 17:32:13 vachis * new api implemention Index: SnapshotImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/SnapshotImpl.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** SnapshotImpl.java 6 May 2002 17:32:13 -0000 1.20 --- SnapshotImpl.java 7 May 2002 21:11:38 -0000 1.21 *************** *** 554,558 **** List listInner; List postOpLst = new LinkedList(); - List postOpIterLst = new LinkedList(); IDObjectData obj, objInner, objOpposite; --- 554,557 ---- *************** *** 592,597 **** sid = (IProf.sID) iterInner.next(); //this could by factory ! objInner = createAndPutIn( whatType, sid, obj, postOpLst, ! postOpIterLst ); libIDs.put( objInner.getID(), objInner ); if ( out != null ) --- 591,595 ---- sid = (IProf.sID) iterInner.next(); //this could by factory ! objInner = createAndPutIn( whatType, sid, obj, postOpLst); libIDs.put( objInner.getID(), objInner ); if ( out != null ) *************** *** 604,609 **** //}; - postOpIterLst = doPostOpIter( whatType, obj, postOpIterLst ); - if ( iter == null ) //one pass break; --- 602,605 ---- *************** *** 613,617 **** listInner = null; postOpLst = null; - postOpIterLst = null; } //PENDING trow other exception --- 609,612 ---- *************** *** 647,656 **** 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; } --- 642,652 ---- 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; } *************** *** 659,701 **** 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.getParent(); } } return root; } ! ! /* Uses postOpIterLst, returns new List, which should be used used in next ! * iteration. It called for each extract operation (each obect in List ! * <code>in</code> in method <code>extract()</code> ! */ ! private List doPostOpIter( int whatType, IDObjectData refObj, List postOpIterLst ) { ! if ( postOpIterLst == null ) ! return new LinkedList(); ! // if ( refObj == null ) ! // return postOpIterLst; ! ! switch ( whatType ) { ! case IProf.CLASS_FIELDS_INSTANCES: { ! //PENDING //FIXME ! //((ClassData) refObj).setInstaceFields( postOpIterLst ); ! return new LinkedList(); ! } ! case IProf.CLASS_FIELDS_STATICS: { ! //PENDING //FIXME ! //((ClassData) refObj).setStaticFields( postOpIterLst ); ! return new LinkedList(); ! } ! default: return postOpIterLst; ! } ! } ! /* This method is called at the end of <code>extract()</code> method. */ --- 655,673 ---- 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; } ! /* This method is called at the end of <code>extract()</code> method. */ *************** *** 720,734 **** */ private List createFramesFromInfo( IProf.sTraceInfo trcInfo ) { ! int num = trcInfo.numFrames; ! int i; ! ! List frames = new ArrayList( trcInfo.numFrames ); ! for ( i = 0; i < num; i++ ) ! frames.add(new FrameData( trcInfo.frames[i].lineno, ((MethodData) libIDs.get( new Integer(trcInfo.frames[i].methodObjId ))), (i==0) ? null : ((FrameData) frames.get(i-1)) )); ! return frames; }; --- 692,706 ---- */ private List createFramesFromInfo( IProf.sTraceInfo trcInfo ) { ! int num = trcInfo.numFrames; ! int i; ! ! List frames = new ArrayList( trcInfo.numFrames ); ! for ( i = 0; i < num; i++ ) ! frames.add(new FrameData( trcInfo.frames[i].lineno, ((MethodData) libIDs.get( new Integer(trcInfo.frames[i].methodObjId ))), (i==0) ? null : ((FrameData) frames.get(i-1)) )); ! return frames; }; *************** *** 744,749 **** */ private IDObjectData createAndPutIn( int whatType, IProf.sID sid, ! IDObjectData refObj, List postOpLst, ! List postOpIterLst) { switch ( whatType ) { case IProf.CLASSES: { --- 716,720 ---- */ private IDObjectData createAndPutIn( int whatType, IProf.sID sid, ! IDObjectData refObj, List postOpLst) { switch ( whatType ) { case IProf.CLASSES: { *************** *** 791,795 **** ClassData rf = (ClassData) refObj; FieldData newObj = new FieldData( sid, rf, true ); ! postOpIterLst.add( newObj ); //later setStaticFileds() is called to this List return newObj; } --- 762,766 ---- ClassData rf = (ClassData) refObj; FieldData newObj = new FieldData( sid, rf, true ); ! rf.addField( newObj ); return newObj; } *************** *** 798,802 **** ClassData rf = (ClassData) refObj; FieldData newObj = new FieldData( sid, rf, false ); ! postOpIterLst.add( newObj ); //later setInstanceFileds() is called to this List return newObj; } --- 769,773 ---- ClassData rf = (ClassData) refObj; FieldData newObj = new FieldData( sid, rf, false ); ! rf.addField( newObj ); return newObj; } *************** *** 1132,1136 **** //FIXME: - //creation of fiels, frames, //to fill list of traces --- 1103,1106 ---- *************** *** 1146,1149 **** --- 1116,1123 ---- /* * $Log$ + * Revision 1.21 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.20 2002/05/06 17:32:13 vachis * new api implemention Index: ThreadData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/ThreadData.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** ThreadData.java 6 May 2002 17:32:13 -0000 1.19 --- ThreadData.java 7 May 2002 21:11:38 -0000 1.20 *************** *** 443,451 **** */ public CallTreeRef getCallTree () { ! return null;//callTree; FIXME } - //PENDING active? - public String toString() { return getName(); --- 443,449 ---- */ public CallTreeRef getCallTree () { ! return callTree; } public String toString() { return getName(); *************** *** 455,458 **** --- 453,460 ---- /* * $Log$ + * Revision 1.20 2002/05/07 21:11:38 vachis + * fix creation of fields, frames + * CallTree new api + * * Revision 1.19 2002/05/06 17:32:13 vachis * new api implemention |