|
From: Pavel V. <va...@us...> - 2002-09-02 15:28:05
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data
In directory usw-pr-cvs1:/tmp/cvs-serv3812
Modified Files:
SnapshotImpl.java
Log Message:
difference of snapshot
very poor ipmplementation
Index: SnapshotImpl.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/SnapshotImpl.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** SnapshotImpl.java 28 Aug 2002 17:55:54 -0000 1.32
--- SnapshotImpl.java 2 Sep 2002 15:28:02 -0000 1.33
***************
*** 169,173 ****
*
*@param iprof Communacation object (you have to be connected to profiled VM).
! *@param conf Configuration object, you can tune you snaphot content
*/
//maybe use some configuration object
--- 169,173 ----
*
*@param iprof Communacation object (you have to be connected to profiled VM).
! *@param conf Configuration object, you can tune content of your snaphot
*/
//maybe use some configuration object
***************
*** 184,188 ****
}
!
//////////////////////////////////////////////////////////////////////////
// implementation of Snapshot interface
--- 184,197 ----
}
! /**
! *Creates completely empty snapshot, only configuration is stored. You
! * can fill snapshot with whatever you want.
! * It's used by {@link #diffenceTo }
! *
! *@param conf determines the types of object that will be included in this snapshot
! */
! private SnapshotImpl( Configuration conf ) {
! this.conf = conf;
! }
//////////////////////////////////////////////////////////////////////////
// implementation of Snapshot interface
***************
*** 1135,1138 ****
--- 1144,1242 ----
}
+ /** Creates new snapshot that contains <code>this - B </code> and than restiction to
+ * configuration conf. Difference means that result contains all objects that
+ * are in <code>this</code> and are not in <code> B </code>. Restriction means
+ * that result contains objects that types are specified in configuration.
+ * Confiduration object also defines what infomation are significan for
+ * defenition of equality.
+ *
+ *
+ * @param b secand operand in substraction
+ * @param conf determines restriction, result contains only objects that types
+ * are specified here.
+ */
+ public Snapshot differenceTo(Snapshot b, Snapshot.Configuration conf) {
+ //TODO: all, now it contains only ALLOC_TYPES
+ Configuration confA = new Configuration();
+ confA.withAlloc = true;
+ confA.withTypes = true;
+
+ confA.withArenas = false;
+ confA.withAllocThreads = false;
+ confA.withAllocTraces = false;
+ confA.withCPU = false;
+ confA.withCPUThreads = false;
+ confA.withCPUTraces = false;
+ confA.withCallTree = false;
+ confA.withFields = false;
+ confA.withGC = false;
+ confA.withMon = false;
+ confA.withMonThreads = false;
+ confA.withMonTraces = false;
+
+ SnapshotImpl snap = new SnapshotImpl( confA );
+ Map objMap = new HashMap(); //mapping objects from source (this) to
+ // its copies in result
+ Object obj = null;
+
+ //problem with definition //FIXME
+ /* It's not clear what means difference on root objects, that
+ * can contains information reletad to ALLOC, CPU, MON together
+ * Probably equals operation depends on Configuration.
+ */
+
+ //FIXME
+ /*Problem if i want to trac memory leacks, I need equlity defined
+ *by liveInstacesCount method, I don't care about care about
+ * totalInstacesCount. I did it so.
+ */
+
+ boolean eqL;
+ //temporary solution //FIXME
+ if ( confA.withAlloc ) {
+ ListIterator it1, it2;
+
+ TypeData type1;
+ TypeRef type2;
+ TypeData typeA;
+ ClassData classA;
+ ClassRef class1;
+
+
+ it1 = this.types.listIterator();
+ it2 = b.getTypes().listIterator();
+ while( it1.hasNext() ) {
+ type1 = (TypeData) it1.next();
+ while ( it2.hasNext() ) {
+ type2 = (TypeRef) it2.next();
+ eqL = false;
+ //test of equality
+ eqL = (type1.getLiveInstancesCount() == type2.getLiveInstancesCount());
+ //creation
+ if ( eqL ) {
+ class1 = type1.getComponentClass();
+ obj = objMap.get( class1 );
+ if ( obj == null ) {
+ classA = new ClassData( (ClassData) class1 );
+ objMap.put( class1, classA );
+ snap.classes.add( classA );
+ }
+ else {
+ classA = (ClassData) obj;
+ }
+ typeA = new TypeData( type1, classA, this );
+ snap.types.add( typeA );
+ }
+ }
+ }
+
+ //reletad work TODO:
+ //copy constructor to toher objects not only TypaData
+ //copy stat method to CPU, MON id objects
+
+ }
+ return snap;
+ }
+
}
***************
*** 1146,1149 ****
--- 1250,1257 ----
/*
* $Log$
+ * Revision 1.33 2002/09/02 15:28:02 vachis
+ * difference of snapshot
+ * very poor ipmplementation
+ *
* Revision 1.32 2002/08/28 17:55:54 petrul
* fixed children adding to parents' lists
|