Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun
In directory usw-pr-cvs1:/tmp/cvs-serv8962/net/sourceforge/javaprofiler/jpiimpl/commun
Modified Files:
IProf.java
Log Message:
communication improvements
calltree fixes
Index: IProf.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun/IProf.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** IProf.java 31 Jan 2002 12:32:47 -0000 1.10
--- IProf.java 28 Feb 2002 11:49:26 -0000 1.11
***************
*** 2067,2076 ****
/** methods called by this method
! ** (list of sCallTree objects) */
public LinkedList children;
! /// number of children
public int numOfChildren;
};
--- 2067,2082 ----
/** methods called by this method
! ** (list of sCallTree objects, can be null) */
public LinkedList children;
! /// number of children (always zero)
public int numOfChildren;
+
+ /// parent method
+ public sCallTree parent;
+
+ /// number of items in the subtree
+ public long numOfItems = 1;
};
***************
*** 2108,2141 ****
}
- /** Get subtree of calltree. This method recursively returns
- ** the whole calltree - grabs it from binary buffer and stores
- ** it as a tree of sCallTree structures.
- **
- ** @param b buffer with binary data
- ** @param offset position of data in the buffer
- ** @param ct output structure - root of the subtree
- **
- ** @return position of next item in the buffer */
-
- private int getCallTree( Buffer b, int offset, sCallTree ct) {
-
- offset = getCallTreeItem( b, offset, ct);
-
- int num = ct.numOfChildren;
-
- while( num > 0) {
-
- sCallTree nct = new sCallTree();
- offset = getCallTree( b, offset, nct);
-
- if( ct.children == null) ct.children = new LinkedList();
-
- ct.children.addLast( nct);
- num--;
- }
-
- return offset;
- }
-
/** Get calltree. This method returns the whole calltree
** of methods for given thread.
--- 2114,2117 ----
***************
*** 2169,2173 ****
if( rc != RC_OK) {
! if( rc == RC_BAD_OBJ_ID) throw new BAD_OBJ_ID_Exception();
throw new UNKNOWN_Exception();
--- 2145,2150 ----
if( rc != RC_OK) {
! if( rc == RC_BAD_OBJ_ID)
! throw new BAD_OBJ_ID_Exception();
throw new UNKNOWN_Exception();
***************
*** 2175,2181 ****
if( _buf.getSize() == 4) return null;
!
! sCallTree root = new sCallTree();
! getCallTree( _buf, pos, root);
return root;
--- 2152,2194 ----
if( _buf.getSize() == 4) return null;
!
! sCallTree parent = null;
! sCallTree root = null;
!
! while( true) {
!
! do {
!
! sCallTree item = new sCallTree();
! item.parent = parent;
!
! if( parent != null)
! parent.children.addLast( item);
! else root = item;
!
! pos = getCallTreeItem( _buf, pos, item);
!
! parent = item;
!
! if( item.numOfChildren > 0)
! item.children = new LinkedList();
!
! } while( parent.numOfChildren > 0);
!
! do {
!
! long n = parent.numOfItems;
! parent = parent.parent;
!
! if( parent == null) break;
!
! parent.numOfChildren--;
! parent.numOfItems += n;
!
! } while( parent.numOfChildren == 0);
!
! if( parent == null) break;
!
! }
return root;
|