|
From: Lukas P. <pe...@us...> - 2002-09-03 17:51:59
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/nodes
In directory usw-pr-cvs1:/tmp/cvs-serv16457
Modified Files:
PDataComparator.java
Log Message:
Alloc Live and Alloc Total
Index: PDataComparator.java
===================================================================
RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/nodes/PDataComparator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** PDataComparator.java 31 Aug 2002 08:42:20 -0000 1.1
--- PDataComparator.java 3 Sep 2002 17:51:55 -0000 1.2
***************
*** 50,59 ****
/** Compare objects by name. */
public static final int NAME=1;
! /** Compare objects by Alloc. */
! public static final int ALLOC=2;
/** Compare objects by CPU. */
! public static final int CPU=3;
/** Compare objects by Mon. */
! public static final int MON=4;
private int type;
--- 50,61 ----
/** Compare objects by name. */
public static final int NAME=1;
! /** Compare objects by Alloc Live. */
! public static final int ALLOC_LIVE=2;
! /** Compare objects by Alloc Total. */
! public static final int ALLOC_TOTAL=3;
/** Compare objects by CPU. */
! public static final int CPU=4;
/** Compare objects by Mon. */
! public static final int MON=5;
private int type;
***************
*** 72,77 ****
case NAME:
return nameCompare((PDataNode) o1, (PDataNode) o2);
! case ALLOC:
! return allocCompare((PDataNode) o1, (PDataNode) o2);
case CPU:
return cpuCompare((PDataNode) o1, (PDataNode) o2);
--- 74,81 ----
case NAME:
return nameCompare((PDataNode) o1, (PDataNode) o2);
! case ALLOC_LIVE:
! return allocLiveCompare((PDataNode) o1, (PDataNode) o2);
! case ALLOC_TOTAL:
! return allocTotalCompare((PDataNode) o1, (PDataNode) o2);
case CPU:
return cpuCompare((PDataNode) o1, (PDataNode) o2);
***************
*** 87,92 ****
return n1.getDisplayName().compareTo(n2.getDisplayName());
}
! /** Compares by Alloc in descending order. */
! private int allocCompare(PDataNode n1, PDataNode n2) {
AllocStat a1=(AllocStat) n1.getDataObject();
AllocStat a2=(AllocStat) n2.getDataObject();
--- 91,96 ----
return n1.getDisplayName().compareTo(n2.getDisplayName());
}
! /** Compares by Alloc Live in descending order. */
! private int allocLiveCompare(PDataNode n1, PDataNode n2) {
AllocStat a1=(AllocStat) n1.getDataObject();
AllocStat a2=(AllocStat) n2.getDataObject();
***************
*** 100,103 ****
--- 104,120 ----
return 0;
}
+ /** Compares by Alloc Total in descending order. */
+ private int allocTotalCompare(PDataNode n1, PDataNode n2) {
+ AllocStat a1=(AllocStat) n1.getDataObject();
+ AllocStat a2=(AllocStat) n2.getDataObject();
+ long d=a1.getTotalInstancesSize() - a2.getTotalInstancesSize();
+ if (d!=0)
+ return (-d>0) ? 1 : -1;
+ d=a1.getLiveInstancesSize() - a2.getLiveInstancesSize();
+ if (d!=0)
+ return (-d>0) ? 1 : -1;
+ else
+ return 0;
+ }
/** Compares by CPU in descending order. */
private int cpuCompare(PDataNode n1, PDataNode n2) {
***************
*** 130,133 ****
--- 147,153 ----
/*
* $Log$
+ * Revision 1.2 2002/09/03 17:51:55 petrul
+ * Alloc Live and Alloc Total
+ *
* Revision 1.1 2002/08/31 08:42:20 petrul
* comparator of PDataNode
|