MemoryProfilerStage extends StreamingStage implements CodeNavigator.Listener { @NotNull public LiveAllocationSamplingMode getLiveAllocationSamplingMode() { return myLiveAllocationSamplingMode; } MemoryProfilerStage(@NotNull StudioProfilers profilers); @VisibleForTesting  MemoryProfilerStage(@NotNull StudioProfilers profilers, @NotNull CaptureObjectLoader loader); boolean hasUserUsedMemoryCapture(); DetailedMemoryUsage getDetailedMemoryUsage(); @Override void enter(); @Override void exit(); @NotNull RangeSelectionModel getRangeSelectionModel(); @NotNull StackTraceModel getAllocationStackTraceModel(); @NotNull StackTraceModel getDeallocationStackTraceModel(); void enableSelectLatestCapture(boolean enable, @Nullable Executor loadJoiner); boolean isMemoryCaptureOnly(); void setPendingCaptureStartTime(long pendingCaptureStartTime); @NotNull AspectModel<MemoryProfilerAspect> getAspect(); void requestHeapDump(); void forceGarbageCollection(); DurationDataModel<CaptureDurationData<CaptureObject>> getHeapDumpSampleDurations(); void trackAllocations(boolean enable); boolean isTrackingAllocations(); long getAllocationTrackingElapsedTimeNs(); @Nullable CaptureDurationData<? extends CaptureObject> getIntersectingCaptureDuration(@NotNull Range range); boolean useLiveAllocationTracking(); @NotNull DurationDataModel<CaptureDurationData<CaptureObject>> getAllocationInfosDurations(); void selectFieldObjectPath(@NotNull List<FieldObject> fieldObjectPath); @NotNull List<FieldObject> getSelectedFieldObjectPath(); void selectInstanceObject(@Nullable InstanceObject instanceObject); @Nullable InstanceObject getSelectedInstanceObject(); void selectClassSet(@Nullable ClassSet classSet); @Nullable ClassSet getSelectedClassSet(); void refreshSelectedHeap(); void selectHeapSet(@Nullable HeapSet heapSet); @Nullable HeapSet getSelectedHeapSet(); @NotNull FilterHandler getFilterHandler(); @NotNull List<LiveAllocationSamplingMode> getSupportedLiveAllocationSamplingMode(); @NotNull LiveAllocationSamplingMode getLiveAllocationSamplingMode(); void requestLiveAllocationSamplingModeUpdate(@NotNull LiveAllocationSamplingMode mode); @Nullable CaptureObject getSelectedCapture(); @NotNull MemoryProfilerConfiguration getConfiguration(); AxisComponentModel getMemoryAxis(); AxisComponentModel getObjectsAxis(); MemoryStageLegends getLegends(); MemoryStageLegends getTooltipLegends(); @NotNull EaseOutModel getInstructionsEaseOutModel(); EventMonitor getEventMonitor(); @NotNull DurationDataModel<GcDurationData> getGcStatsModel(); String getName(); @Override void onNavigated(@NotNull CodeLocation location); static boolean canSafelyLoadHprof(long fileSize); static final String LIVE_ALLOCATION_SAMPLING_PREF; static final LiveAllocationSamplingMode DEFAULT_LIVE_ALLOCATION_SAMPLING_MODE; static final int MEMORY_HPROF_SAFE_FACTOR; }
@Test public void testAllocationSamplingRateCorrectlyInitialized() { if (myUnifiedPipeline) { myTransportService.addEventToStream( FAKE_DEVICE_ID, ProfilersTestData.generateMemoryAllocSamplingData(FAKE_PROCESS.getPid(), 0, 1).build()); } else { AllocationSamplingRateEvent fullTrackingMode = AllocationSamplingRateEvent.newBuilder() .setSamplingRate(MemoryAllocSamplingData.newBuilder().setSamplingNumInterval(1)) .build(); myService .setMemoryData(MemoryData.newBuilder().addAllocSamplingRateEvents(fullTrackingMode).build()); } MemoryProfilerStage stage = new MemoryProfilerStage(myProfilers, myMockLoader); assertThat(stage.getLiveAllocationSamplingMode()).isEqualTo(MemoryProfilerStage.LiveAllocationSamplingMode.FULL); }