1.1 --- a/lib.profiler/src/org/netbeans/lib/profiler/results/cpu/CPUResultsSnapshot.java Fri Aug 07 16:09:11 2015 +0200
1.2 +++ b/lib.profiler/src/org/netbeans/lib/profiler/results/cpu/CPUResultsSnapshot.java Thu Aug 06 23:29:46 2015 +0200
1.3 @@ -344,25 +344,53 @@
1.4 int[] threadIds = getThreadIds();
1.5 List<PrestimeCPUCCTNode> nodes = new ArrayList();
1.6 for (int i = 0; i < threadIds.length; i++) {
1.7 - final int _threadId = threadIds[i];
1.8 - if (threads == null || threads.contains(_threadId)) {
1.9 - final CPUCCTContainer container = getContainerForThread(_threadId, view);
1.10 - final FlatProfileContainer flat = container.getFlatProfile();
1.11 + final int threadIdF = threadIds[i];
1.12 + if (threads == null || threads.contains(threadIdF)) {
1.13 + final CPUCCTContainer containerF = getContainerForThread(threadIdF, view);
1.14 + final FlatProfileContainer flatF = containerF.getFlatProfile();
1.15
1.16 - PrestimeCPUCCTNodeBacked threadNode = new PrestimeCPUCCTNodeBacked(container, null) {
1.17 - public CCTNode[] getChildren() {
1.18 + class ThreadNodeBacked extends PrestimeCPUCCTNodeBacked {
1.19 + ThreadNodeBacked() {
1.20 + super(containerF, null);
1.21 + nCalls = (int)flatF.getNTotalInvocations();
1.22 + totalTime0 = containerF.getWholeGraphNetTime0();
1.23 + totalTime1 = containerF.getWholeGraphNetTime1();
1.24 + nChildren = flatF.getNRows();
1.25 + }
1.26 + PrestimeCPUCCTNode createCopy() {
1.27 + ThreadNodeBacked copy = new ThreadNodeBacked();
1.28 + setupCopy(copy);
1.29 + return copy;
1.30 + }
1.31 + public PrestimeCPUCCTNode[] getChildren() {
1.32 if (nChildren == 0) return null;
1.33 -
1.34 +
1.35 if (children == null) {
1.36 - children = new PrestimeCPUCCTNode[flat.getNRows()];
1.37 + children = new PrestimeCPUCCTNode[flatF.getNRows()];
1.38 for (int m = 0; m < children.length; m++) {
1.39 - final int _methodId = flat.getMethodIdAtRow(m);
1.40 - PrestimeCPUCCTNodeBacked n = new PrestimeCPUCCTNodeBacked() {
1.41 - public CCTNode[] getChildren() {
1.42 + final int mF = m;
1.43 + final int methodIdF = flatF.getMethodIdAtRow(m);
1.44 +
1.45 + class ReverseNodeBacked extends PrestimeCPUCCTNodeBacked {
1.46 + ReverseNodeBacked() {
1.47 + nChildren = 1;
1.48 + container = ThreadNodeBacked.this.container;
1.49 + methodId = methodIdF;
1.50 + nCalls = flatF.getNInvocationsAtRow(mF);
1.51 + totalTime0 = flatF.getTotalTimeInMcs0AtRow(mF);
1.52 + totalTime1 = flatF.getTotalTimeInMcs1AtRow(mF);
1.53 + parent = ThreadNodeBacked.this;
1.54 + }
1.55 + PrestimeCPUCCTNode createCopy() {
1.56 + ReverseNodeBacked copy = new ReverseNodeBacked();
1.57 + setupCopy(copy);
1.58 + return copy;
1.59 + }
1.60 + public PrestimeCPUCCTNode[] getChildren() {
1.61 if (nChildren == 0) return null;
1.62 -
1.63 +
1.64 if (children == null) {
1.65 - PrestimeCPUCCTNode r = getReverseCCT(_threadId, _methodId, view);
1.66 + PrestimeCPUCCTNode r = getReverseCCT(threadIdF, methodIdF, view);
1.67 children = r.children;
1.68 nChildren = children == null ? 0 : children.length;
1.69 if (nChildren > 0) for (PrestimeCPUCCTNode ch : children) ch.parent = this;
1.70 @@ -370,26 +398,17 @@
1.71
1.72 return children;
1.73 }
1.74 - };
1.75 - n.nChildren = 1;
1.76 - n.container = container;
1.77 - n.methodId = _methodId;
1.78 - n.nCalls = flat.getNInvocationsAtRow(m);
1.79 - n.totalTime0 = flat.getTotalTimeInMcs0AtRow(m);
1.80 - n.totalTime1 = flat.getTotalTimeInMcs1AtRow(m);
1.81 - n.parent = this;
1.82 - children[m] = n;
1.83 + }
1.84 +
1.85 + children[m] = new ReverseNodeBacked();
1.86 }
1.87 }
1.88
1.89 return children;
1.90 }
1.91 - };
1.92 - threadNode.nCalls = (int)flat.getNTotalInvocations();
1.93 - threadNode.totalTime0 = container.getWholeGraphNetTime0();
1.94 - threadNode.totalTime1 = container.getWholeGraphNetTime1();
1.95 - threadNode.nChildren = flat.getNRows();
1.96 - nodes.add(threadNode);
1.97 + }
1.98 +
1.99 + nodes.add(new ThreadNodeBacked());
1.100 }
1.101 }
1.102
2.1 --- a/lib.profiler/src/org/netbeans/lib/profiler/results/cpu/PrestimeCPUCCTNodeBacked.java Fri Aug 07 16:09:11 2015 +0200
2.2 +++ b/lib.profiler/src/org/netbeans/lib/profiler/results/cpu/PrestimeCPUCCTNodeBacked.java Thu Aug 06 23:29:46 2015 +0200
2.3 @@ -126,8 +126,9 @@
2.4 void setupCopy(PrestimeCPUCCTNodeBacked node) {
2.5 super.setupCopy(node);
2.6 node.selfCompactDataOfs = selfCompactDataOfs;
2.7 - node.compactDataOfs = new HashSet();
2.8 - node.compactDataOfs.add(node.selfCompactDataOfs);
2.9 + node.compactDataOfs = compactDataOfs;
2.10 +// node.compactDataOfs = new HashSet();
2.11 +// node.compactDataOfs.add(node.selfCompactDataOfs);
2.12 node.nChildren = nChildren;
2.13 }
2.14