From 34f2442794563003eb969cee1022a51c7f6593af Mon Sep 17 00:00:00 2001 From: Geneviève Bastien Date: Wed, 4 Apr 2018 16:46:06 -0400 Subject: callstack: Remove the depth from the function classes The depth value is not used, the caller usually already have this information, so no need for the function to pass it around. Change-Id: Id40792c0cb9c48c630fe047c010bcf619160d762 Signed-off-by: Geneviève Bastien Reviewed-on: https://git.eclipse.org/r/120743 Tested-by: CI Bot Reviewed-by: Matthew Khouzam --- .../core/tests/callgraph/CalledFunctionTest.java | 46 +++++++++------------- .../core/tests/flamechart/CallStackTest.java | 42 ++++++++++---------- .../callstack/core/flamechart/CallStack.java | 6 +-- .../core/instrumented/ICalledFunction.java | 7 ---- .../instrumented/statesystem/CallStackSeries.java | 2 +- .../callgraph/AbstractCalledFunction.java | 35 ++++------------ .../instrumented/callgraph/CalledFunction.java | 6 +-- .../callgraph/CalledFunctionFactory.java | 22 ++++------- .../callgraph/CalledStringFunction.java | 6 +-- 9 files changed, 62 insertions(+), 110 deletions(-) diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/callgraph/CalledFunctionTest.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/callgraph/CalledFunctionTest.java index b06f1c93a..19e6cc534 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/callgraph/CalledFunctionTest.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/callgraph/CalledFunctionTest.java @@ -48,12 +48,12 @@ public class CalledFunctionTest { */ @Before public void setup() { - ICalledFunction fixture = CalledFunctionFactory.create(10, 1010, 0, TmfStateValue.newValueString("Hello"), 0, 0, null, fModel); + ICalledFunction fixture = CalledFunctionFactory.create(10, 1010, TmfStateValue.newValueString("Hello"), 0, 0, null, fModel); assertTrue(fixture instanceof CalledStringFunction); fFixture = (CalledStringFunction) fixture; - ICalledFunction fixture42 = CalledFunctionFactory.create(400, 500, 1, TmfStateValue.newValueLong(0x42), 0, 0, fFixture, fModel); + ICalledFunction fixture42 = CalledFunctionFactory.create(400, 500, TmfStateValue.newValueLong(0x42), 0, 0, fFixture, fModel); f42Fixture = fixture42; - ICalledFunction hiFixture = CalledFunctionFactory.create(20, 50, 1, "Hi", 0, 0, fFixture, fModel); + ICalledFunction hiFixture = CalledFunctionFactory.create(20, 50, "Hi", 0, 0, fFixture, fModel); fHiFixture = hiFixture; } @@ -62,9 +62,9 @@ public class CalledFunctionTest { * value */ public void createValid() { - assertNotNull(CalledFunctionFactory.create(0, 0, 0, TmfStateValue.newValueLong(0), 0, 0, null, fModel)); - assertNotNull(CalledFunctionFactory.create(0, 0, 0, TmfStateValue.newValueInt(0), 0, 0, null, fModel)); - assertNotNull(CalledFunctionFactory.create(0, 0, 0, TmfStateValue.newValueString(""), 0, 0, null, fModel)); + assertNotNull(CalledFunctionFactory.create(0, 0, TmfStateValue.newValueLong(0), 0, 0, null, fModel)); + assertNotNull(CalledFunctionFactory.create(0, 0, TmfStateValue.newValueInt(0), 0, 0, null, fModel)); + assertNotNull(CalledFunctionFactory.create(0, 0, TmfStateValue.newValueString(""), 0, 0, null, fModel)); } /** @@ -72,7 +72,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidDouble() { - CalledFunctionFactory.create(0, 0, 0, TmfStateValue.newValueDouble(3.14), 0, 0, null, fModel); + CalledFunctionFactory.create(0, 0, TmfStateValue.newValueDouble(3.14), 0, 0, null, fModel); } /** @@ -80,7 +80,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidNull() { - CalledFunctionFactory.create(0, 0, 0, TmfStateValue.nullValue(), 0, 0, null, fModel); + CalledFunctionFactory.create(0, 0, TmfStateValue.nullValue(), 0, 0, null, fModel); } /** @@ -88,7 +88,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidTimeRange() { - CalledFunctionFactory.create(10, -10, 0, "", 0, 0, null, fModel); + CalledFunctionFactory.create(10, -10, "", 0, 0, null, fModel); } /** @@ -96,7 +96,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidTimeRangeStateLong() { - CalledFunctionFactory.create(10, -10, 0, TmfStateValue.newValueLong(42), 0, 0, null, fModel); + CalledFunctionFactory.create(10, -10, TmfStateValue.newValueLong(42), 0, 0, null, fModel); } /** @@ -104,7 +104,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidTimeRangeStateInteger() { - CalledFunctionFactory.create(10, -10, 0, TmfStateValue.newValueInt(42), 0, 0, null, fModel); + CalledFunctionFactory.create(10, -10, TmfStateValue.newValueInt(42), 0, 0, null, fModel); } /** @@ -112,7 +112,7 @@ public class CalledFunctionTest { */ @Test(expected = IllegalArgumentException.class) public void createInvalidTimeRangeStateString() { - CalledFunctionFactory.create(10, -10, 0, TmfStateValue.newValueString("42"), 0, 0, null, fModel); + CalledFunctionFactory.create(10, -10, TmfStateValue.newValueString("42"), 0, 0, null, fModel); } /** @@ -121,7 +121,7 @@ public class CalledFunctionTest { @Test public void testAddChildOk1() { assertNotNull(fFixture); - CalledFunction newchild = (CalledFunction) CalledFunctionFactory.create(100, 200, 1, TmfStateValue.newValueInt(0x64), 0, 0, fFixture, fModel); + CalledFunction newchild = (CalledFunction) CalledFunctionFactory.create(100, 200, TmfStateValue.newValueInt(0x64), 0, 0, fFixture, fModel); ICalledFunction hiFixture = fHiFixture; ICalledFunction fixture42 = f42Fixture; assertNotNull(hiFixture); @@ -137,7 +137,7 @@ public class CalledFunctionTest { @Test public void testAddChildOk2() { assertNotNull(fFixture); - CalledStringFunction newchild = CalledFunctionFactory.create(450, 490, 1, "OK", 0, 0, f42Fixture, fModel); + CalledStringFunction newchild = CalledFunctionFactory.create(450, 490, "OK", 0, 0, f42Fixture, fModel); ICalledFunction hiFixture = fHiFixture; ICalledFunction fixture42 = f42Fixture; assertNotNull(hiFixture); @@ -153,7 +153,7 @@ public class CalledFunctionTest { @Test public void testAddChildOk3() { assertNotNull(fFixture); - CalledStringFunction newchild = CalledFunctionFactory.create(450, 490, 1, "OK", 0, 0, fHiFixture, fModel); + CalledStringFunction newchild = CalledFunctionFactory.create(450, 490, "OK", 0, 0, fHiFixture, fModel); ICalledFunction hiFixture = fHiFixture; ICalledFunction fixture42 = f42Fixture; assertNotNull(hiFixture); @@ -189,7 +189,7 @@ public class CalledFunctionTest { @Test public void testEquals() { assertEquals(fFixture, fFixture); - assertEquals(fHiFixture, CalledFunctionFactory.create(20, 50, 1, "Hi", 0, 0, fFixture, fModel)); + assertEquals(fHiFixture, CalledFunctionFactory.create(20, 50, "Hi", 0, 0, fFixture, fModel)); assertNotEquals(fFixture, f42Fixture); assertNotEquals(fFixture, fHiFixture); assertNotEquals(fFixture, null); @@ -210,16 +210,6 @@ public class CalledFunctionTest { assertEquals(Collections.emptyList(), fixtureHi.getChildren()); } - /** - * Test get depth - */ - @Test - public void testGetDepth() { - assertEquals(0, fFixture.getDepth()); - assertEquals(1, fHiFixture.getDepth()); - assertEquals(1, f42Fixture.getDepth()); - } - /** * Test get end. Simple getter test */ @@ -278,10 +268,10 @@ public class CalledFunctionTest { @Test public void testHashCode() { assertEquals(f42Fixture.hashCode(), f42Fixture.hashCode()); - ICalledFunction calledFunction = CalledFunctionFactory.create(400, 500, 1, TmfStateValue.newValueLong(0x42), 0, 0, fFixture, fModel); + ICalledFunction calledFunction = CalledFunctionFactory.create(400, 500, TmfStateValue.newValueLong(0x42), 0, 0, fFixture, fModel); assertEquals(f42Fixture, calledFunction); assertEquals(f42Fixture.hashCode(), calledFunction.hashCode()); - calledFunction = CalledFunctionFactory.create(20, 50, 1, "Hi", 0, 0, fFixture, fModel); + calledFunction = CalledFunctionFactory.create(20, 50, "Hi", 0, 0, fFixture, fModel); assertEquals(fHiFixture, calledFunction); assertEquals(fHiFixture.hashCode(), calledFunction.hashCode()); } diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java index 0b9439cf5..c258ce36d 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core.tests/src/org/eclipse/tracecompass/incubator/callstack/core/tests/flamechart/CallStackTest.java @@ -108,18 +108,18 @@ public class CallStackTest extends CallStackTestBase { /* Check the first level */ List callList = callStack.getCallListAtDepth(1, START_TIME, END_TIME, 1, MONITOR); assertEquals(2, callList.size()); - assertEquals(CalledFunctionFactory.create(1L, 10L, 1, "op1", 1, 2, null, model), callList.get(0)); - assertEquals(CalledFunctionFactory.create(12L, 20L, 1, "op4", 1, 2, null, model), callList.get(1)); + assertEquals(CalledFunctionFactory.create(1L, 10L, "op1", 1, 2, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(12L, 20L, "op4", 1, 2, null, model), callList.get(1)); /* Check the second level */ callList = callStack.getCallListAtDepth(2, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(3L, 7L, 2, "op2", 1, 2, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(3L, 7L, "op2", 1, 2, null, model), callList.get(0)); /* Check the third level */ callList = callStack.getCallListAtDepth(3, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(4L, 5L, 3, "op3", 1, 2, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(4L, 5L, "op3", 1, 2, null, model), callList.get(0)); /* Check the host thread */ assertEquals(new HostThread(trace.getHostId(), 2), callStack.getHostThread(1L)); @@ -137,13 +137,13 @@ public class CallStackTest extends CallStackTestBase { /* Check the first level */ List callList = callStack.getCallListAtDepth(1, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(3L, 20L, 1, "op2", 1, 3, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(3L, 20L, "op2", 1, 3, null, model), callList.get(0)); /* Check the second level */ callList = callStack.getCallListAtDepth(2, START_TIME, END_TIME, 1, MONITOR); assertEquals(2, callList.size()); - assertEquals(CalledFunctionFactory.create(5L, 6L, 2, "op3", 1, 3, null, model), callList.get(0)); - assertEquals(CalledFunctionFactory.create(7L, 13L, 2, "op2", 1, 3, null, model), callList.get(1)); + assertEquals(CalledFunctionFactory.create(5L, 6L, "op3", 1, 3, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(7L, 13L, "op2", 1, 3, null, model), callList.get(1)); /* Check the host thread */ assertEquals(new HostThread(trace.getHostId(), 3), callStack.getHostThread(1L)); @@ -179,20 +179,20 @@ public class CallStackTest extends CallStackTestBase { /* Check the first level */ List callList = callStack.getCallListAtDepth(1, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(1L, 20L, 1, "op1", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(1L, 20L, "op1", 1, 6, null, model), callList.get(0)); /* Check the second level */ callList = callStack.getCallListAtDepth(2, START_TIME, END_TIME, 1, MONITOR); assertEquals(3, callList.size()); - assertEquals(CalledFunctionFactory.create(2L, 7L, 2, "op3", 1, 6, null, model), callList.get(0)); - assertEquals(CalledFunctionFactory.create(8L, 11L, 2, "op2", 1, 6, null, model), callList.get(1)); - assertEquals(CalledFunctionFactory.create(12L, 20L, 2, "op4", 1, 6, null, model), callList.get(2)); + assertEquals(CalledFunctionFactory.create(2L, 7L, "op3", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(8L, 11L, "op2", 1, 6, null, model), callList.get(1)); + assertEquals(CalledFunctionFactory.create(12L, 20L, "op4", 1, 6, null, model), callList.get(2)); /* Check the third level */ callList = callStack.getCallListAtDepth(3, START_TIME, END_TIME, 1, MONITOR); assertEquals(2, callList.size()); - assertEquals(CalledFunctionFactory.create(4L, 6L, 3, "op1", 1, 6, null, model), callList.get(0)); - assertEquals(CalledFunctionFactory.create(9L, 10L, 3, "op3", 1, 6, null, model), callList.get(1)); + assertEquals(CalledFunctionFactory.create(4L, 6L, "op1", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(9L, 10L, "op3", 1, 6, null, model), callList.get(1)); /* Check the host thread */ assertEquals(new HostThread(trace.getHostId(), 6), callStack.getHostThread(1L)); @@ -210,19 +210,19 @@ public class CallStackTest extends CallStackTestBase { /* Check the first level */ List callList = callStack.getCallListAtDepth(1, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(1L, 20L, 1, "op5", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(1L, 20L, "op5", 1, 6, null, model), callList.get(0)); /* Check the second level */ callList = callStack.getCallListAtDepth(2, START_TIME, END_TIME, 1, MONITOR); assertEquals(3, callList.size()); - assertEquals(CalledFunctionFactory.create(2L, 6L, 2, "op2", 1, 6, null, model), callList.get(0)); - assertEquals(CalledFunctionFactory.create(9L, 13L, 2, "op2", 1, 6, null, model), callList.get(1)); - assertEquals(CalledFunctionFactory.create(15L, 19L, 2, "op2", 1, 6, null, model), callList.get(2)); + assertEquals(CalledFunctionFactory.create(2L, 6L, "op2", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(9L, 13L, "op2", 1, 6, null, model), callList.get(1)); + assertEquals(CalledFunctionFactory.create(15L, 19L, "op2", 1, 6, null, model), callList.get(2)); /* Check the third level */ callList = callStack.getCallListAtDepth(3, START_TIME, END_TIME, 1, MONITOR); assertEquals(1, callList.size()); - assertEquals(CalledFunctionFactory.create(10L, 11L, 3, "op3", 1, 6, null, model), callList.get(0)); + assertEquals(CalledFunctionFactory.create(10L, 11L, "op3", 1, 6, null, model), callList.get(0)); /* Check the host thread */ assertEquals(new HostThread(trace.getHostId(), 7), callStack.getHostThread(1L)); @@ -323,15 +323,15 @@ public class CallStackTest extends CallStackTestBase { ICalledFunction function = element.getNextFunction(START_TIME, 2); assertNotNull(function); - assertEquals(CalledFunctionFactory.create(2L, 6L, 2, "op2", 1, 6, null, model), function); + assertEquals(CalledFunctionFactory.create(2L, 6L, "op2", 1, 6, null, model), function); function = element.getNextFunction(function.getEnd(), 2); assertNotNull(function); - assertEquals(CalledFunctionFactory.create(9L, 13L, 2, "op2", 1, 6, null, model), function); + assertEquals(CalledFunctionFactory.create(9L, 13L, "op2", 1, 6, null, model), function); function = element.getNextFunction(function.getEnd(), 2); assertNotNull(function); - assertEquals(CalledFunctionFactory.create(15L, 19L, 2, "op2", 1, 6, null, model), function); + assertEquals(CalledFunctionFactory.create(15L, 19L, "op2", 1, 6, null, model), function); function = element.getNextFunction(function.getEnd(), 2); assertNull(function); diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java index 77783421b..6564c87b5 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/flamechart/CallStack.java @@ -120,7 +120,7 @@ public class CallStack { } if (!callInterval.getStateValue().isNull()) { int threadId = getThreadId(callInterval.getStartTime()); - callList.add(CalledFunctionFactory.create(callInterval.getStartTime(), callInterval.getEndTime() + 1, depth, callInterval.getStateValue(), getSymbolKeyAt(callInterval.getStartTime()), threadId, + callList.add(CalledFunctionFactory.create(callInterval.getStartTime(), callInterval.getEndTime() + 1, callInterval.getStateValue(), getSymbolKeyAt(callInterval.getStartTime()), threadId, null, ModelManager.getModelFor(getHostId(callInterval.getStartTime())))); } } @@ -187,7 +187,7 @@ public class CallStack { interval = fStateSystem.querySingleState(interval.getEndTime() + 1, fQuarks.get(depth - 1)); } if (!interval.getStateValue().isNull() && interval.getStartTime() >= time) { - return CalledFunctionFactory.create(interval.getStartTime(), interval.getEndTime() + 1, depth, interval.getStateValue(), getSymbolKeyAt(interval.getStartTime()), getThreadId(interval.getStartTime()), null, + return CalledFunctionFactory.create(interval.getStartTime(), interval.getEndTime() + 1, interval.getStateValue(), getSymbolKeyAt(interval.getStartTime()), getThreadId(interval.getStartTime()), null, ModelManager.getModelFor(getHostId(time))); } } catch (StateSystemDisposedException e) { @@ -233,7 +233,7 @@ public class CallStack { interval = fStateSystem.querySingleState(interval.getEndTime() + 1, fQuarks.get(depth - 1)); } if (!interval.getStateValue().isNull() && interval.getStartTime() < end) { - return CalledFunctionFactory.create(Math.max(start, interval.getStartTime()), Math.min(end, interval.getEndTime() + 1), depth, interval.getStateValue(), getSymbolKeyAt(interval.getStartTime()), getThreadId(interval.getStartTime()), parent, model); + return CalledFunctionFactory.create(Math.max(start, interval.getStartTime()), Math.min(end, interval.getEndTime() + 1), interval.getStateValue(), getSymbolKeyAt(interval.getStartTime()), getThreadId(interval.getStartTime()), parent, model); } } catch (StateSystemDisposedException e) { diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/ICalledFunction.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/ICalledFunction.java index e1f8fa0f5..74cc57cb3 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/ICalledFunction.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/ICalledFunction.java @@ -66,13 +66,6 @@ public interface ICalledFunction extends INamedSegment { */ long getCpuTime(); - /** - * The depth in the call stack of a function - * - * @return The depth of a function - */ - int getDepth(); - /** * The process ID of the traced application * diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java index 7eee6d9c1..a9224cf6f 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/statesystem/CallStackSeries.java @@ -574,7 +574,7 @@ public class CallStackSeries implements ISegmentStore { if (hostThread == null) { hostThread = new HostThread(StringUtils.EMPTY, IHostModel.UNKNOWN_TID); } - return CalledFunctionFactory.create(interval.getStartTime(), interval.getEndTime() + 1, 0, interval.getStateValue(), -1, hostThread.getTid(), + return CalledFunctionFactory.create(interval.getStartTime(), interval.getEndTime() + 1, interval.getStateValue(), -1, hostThread.getTid(), null, ModelManager.getModelFor(hostThread.getHost())); }; return Iterables.transform(query2d, fct); diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/AbstractCalledFunction.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/AbstractCalledFunction.java index 5977b1d2c..cc6ef2ecc 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/AbstractCalledFunction.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/AbstractCalledFunction.java @@ -51,7 +51,6 @@ abstract class AbstractCalledFunction implements ICalledFunction { protected final long fStart; protected final long fEnd; - protected final int fDepth; private final List fChildren = new ArrayList<>(); private final @Nullable ICalledFunction fParent; protected long fSelfTime = 0; @@ -61,13 +60,12 @@ abstract class AbstractCalledFunction implements ICalledFunction { private final transient IHostModel fModel; private transient long fCpuTime = Long.MIN_VALUE; - public AbstractCalledFunction(long start, long end, int depth, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + public AbstractCalledFunction(long start, long end, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + "[" + start + "," + end + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } fStart = start; fEnd = end; - fDepth = depth; fParent = parent; // It'll be modified once we add a child to it fSelfTime = fEnd - fStart; @@ -145,11 +143,6 @@ abstract class AbstractCalledFunction implements ICalledFunction { return cpuTime; } - @Override - public int getDepth() { - return fDepth; - } - @Override public int getProcessId() { return fProcessId; @@ -175,7 +168,7 @@ abstract class AbstractCalledFunction implements ICalledFunction { @Override public int hashCode() { - return Objects.hash(fDepth, fEnd, fParent, fSelfTime, fStart, getSymbol()); + return Objects.hash(fEnd, fParent, fSelfTime, fStart, getSymbol()); } @Override @@ -190,25 +183,11 @@ abstract class AbstractCalledFunction implements ICalledFunction { return false; } AbstractCalledFunction other = (AbstractCalledFunction) obj; - if (fDepth != other.fDepth) { - return false; - } - if (fEnd != other.fEnd) { - return false; - } - if (fSelfTime != other.fSelfTime) { - return false; - } - if (fStart != other.fStart) { - return false; - } - if (!Objects.equals(fParent, other.getParent())) { - return false; - } - if (!Objects.equals(getSymbol(), other.getSymbol())) { - return false; - } - return true; + return (fEnd == other.fEnd && + fSelfTime == other.fSelfTime && + fStart == other.fStart && + Objects.equals(fParent, other.getParent()) && + Objects.equals(getSymbol(), other.getSymbol())); } } \ No newline at end of file diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunction.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunction.java index 6ca461967..7785a5cf1 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunction.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunction.java @@ -39,8 +39,6 @@ public class CalledFunction extends AbstractCalledFunction { * End position of the segment * @param symbol * The symbol of the call stack function - * @param depth - * The depth in the call stack of a function * @param processId * The process ID of the traced application * @param threadId @@ -50,8 +48,8 @@ public class CalledFunction extends AbstractCalledFunction { * @param model * The operating system model to provide CPU times */ - protected CalledFunction(long start, long end, long symbol, int depth, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { - super(start, end, depth, processId, threadId, parent, model); + protected CalledFunction(long start, long end, long symbol, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + super(start, end, processId, threadId, parent, model); fSymbol = symbol; } diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunctionFactory.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunctionFactory.java index b09ce26ce..e7205f179 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunctionFactory.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledFunctionFactory.java @@ -35,8 +35,6 @@ public final class CalledFunctionFactory { * the start time * @param end * the end time - * @param depth - * the depth * @param stateValue * the symbol * @param processId @@ -50,14 +48,14 @@ public final class CalledFunctionFactory { * The operating system model this function is a part of * @return an ICalledFunction with the specified properties */ - public static AbstractCalledFunction create(long start, long end, int depth, ITmfStateValue stateValue, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + public static AbstractCalledFunction create(long start, long end, ITmfStateValue stateValue, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { switch (stateValue.getType()) { case INTEGER: - return create(start, end, depth, stateValue.unboxInt(), processId, threadId, parent, model); + return create(start, end, stateValue.unboxInt(), processId, threadId, parent, model); case LONG: - return create(start, end, depth, stateValue.unboxLong(), processId, threadId, parent, model); + return create(start, end, stateValue.unboxLong(), processId, threadId, parent, model); case STRING: - return create(start, end, depth, stateValue.unboxStr(), processId, threadId, parent, model); + return create(start, end, stateValue.unboxStr(), processId, threadId, parent, model); case CUSTOM: // Fall through case DOUBLE: @@ -77,8 +75,6 @@ public final class CalledFunctionFactory { * the start time * @param end * the end time - * @param depth - * the depth * @param value * the symbol * @param processId @@ -87,11 +83,11 @@ public final class CalledFunctionFactory { * the parent node * @return an ICalledFunction with the specified propertiess */ - private static CalledFunction create(long start, long end, int depth, long value, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + private static CalledFunction create(long start, long end, long value, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } - return new CalledFunction(start, end, value, depth, processId, threadId, parent, model); + return new CalledFunction(start, end, value, processId, threadId, parent, model); } /** @@ -102,8 +98,6 @@ public final class CalledFunctionFactory { * the start time * @param end * the end time - * @param depth - * the depth * @param value * the symbol * @param processId @@ -117,11 +111,11 @@ public final class CalledFunctionFactory { * The operating system model this function is a part of * @return an ICalledFunction with the specified properties */ - public static CalledStringFunction create(long start, long end, int depth, String value, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + public static CalledStringFunction create(long start, long end, String value, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } - return new CalledStringFunction(start, end, value, depth, processId, threadId, parent, model); + return new CalledStringFunction(start, end, value, processId, threadId, parent, model); } } diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledStringFunction.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledStringFunction.java index dbf6936d0..aa31688d5 100644 --- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledStringFunction.java +++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/internal/callstack/core/instrumented/callgraph/CalledStringFunction.java @@ -41,8 +41,6 @@ public class CalledStringFunction extends AbstractCalledFunction { * End position of the segment * @param symbol * The symbol of the call stack function - * @param depth - * The depth in the call stack of a function * @param processId * The process ID of the traced application * @param threadId @@ -52,8 +50,8 @@ public class CalledStringFunction extends AbstractCalledFunction { * @param model * The model for the host the traced application is running on */ - protected CalledStringFunction(long start, long end, String symbol, int depth, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { - super(start, end, depth, processId, threadId, parent, model); + protected CalledStringFunction(long start, long end, String symbol, int processId, int threadId, @Nullable ICalledFunction parent, IHostModel model) { + super(start, end, processId, threadId, parent, model); fSymbol = symbol; } -- cgit v1.2.3