CpuCapture implements ConfigurableDurationData { public Cpu.CpuTraceType getType() { return myType; } CpuCapture(@NotNull TraceParser parser, long traceId, Cpu.CpuTraceType type); int getMainThreadId(); @NotNull Timeline getTimeline(); @NotNull Range getRange(); @Nullable CaptureNode getCaptureNode(int threadId); @NotNull Collection<CaptureNode> getCaptureNodes(); boolean containsThread(int threadId); @Override long getDurationUs(); @Override boolean getSelectableWhenMaxDuration(); long getTraceId(); @Override boolean canSelectPartialRange(); void updateClockType(@NotNull ClockType clockType); boolean isDualClock(); Cpu.CpuTraceType getType();  }
@Test public void profilerTypePassedInConstructor() { int traceId = 20; CpuThreadInfo info = new CpuThreadInfo(10, "main"); Range range = new Range(0, 30); Map<CpuThreadInfo, CaptureNode> captureTrees = new ImmutableMap.Builder<CpuThreadInfo, CaptureNode>().put(info, new CaptureNode(new StubCaptureNodeModel())).build(); TraceParser parser = new FakeTraceParser(range, captureTrees, false); CpuCapture capture = new CpuCapture(parser, traceId, Cpu.CpuTraceType.ART); assertThat(capture.getType()).isEqualTo(Cpu.CpuTraceType.ART); capture = new CpuCapture(parser, traceId, Cpu.CpuTraceType.SIMPLEPERF); assertThat(capture.getType()).isEqualTo(Cpu.CpuTraceType.SIMPLEPERF); capture = new CpuCapture(parser, traceId, Cpu.CpuTraceType.ATRACE); assertThat(capture.getType()).isEqualTo(Cpu.CpuTraceType.ATRACE); capture = new CpuCapture(parser, traceId, Cpu.CpuTraceType.UNSPECIFIED_TYPE); assertThat(capture.getType()).isEqualTo(Cpu.CpuTraceType.UNSPECIFIED_TYPE); }