public override void OnEnable(CPUOrGPUProfilerModule cpuModule, IProfilerWindowController profilerWindow, bool isGpuView)
 {
     base.OnEnable(cpuModule, profilerWindow, isGpuView);
     m_FrameIndex = FrameDataView.invalidOrCurrentFrameIndex;
     m_DetailedObjectsView?.OnEnable(cpuModule, this);
     m_DetailedCallsView?.OnEnable(cpuModule, this);
     profilerWindow.frameDataViewAboutToBeDisposed += OnFrameDataViewAboutToBeDisposed;
 }
Esempio n. 2
0
        /// <summary>
        /// Search for a sample fitting the '/' seperated path to it and select it
        /// </summary>
        /// <param name="markerNameOrMarkerNamePath">'/' seperated path to the marker </param>
        /// <param name="frameIndex"> The frame to make the selection in, or -1 to select in currently active frame. </param>
        /// <param name="threadIndex"> The index of the thread to find the sample in. </param>
        /// <returns></returns>
        public static bool SetSelection(this IProfilerFrameTimeViewSampleSelectionController controller, string markerNameOrMarkerNamePath, long frameIndex = FrameDataView.invalidOrCurrentFrameIndex, string threadGroupName = CPUProfilerModule.mainThreadGroupName, string threadName = CPUProfilerModule.mainThreadName, ulong threadId = FrameDataView.invalidThreadId)
        {
            var iController = controller as IProfilerFrameTimeViewSampleSelectionControllerInternal;

            if (controller == null || iController == null)
            {
                throw new ArgumentNullException($"{nameof(controller)}", $"The IProfilerFrameTimeViewSampleSelectionController you are setting a selection on can't be null.");
            }

            ProfilerTimeSampleSelection selection;
            List <int> markerIdPath;

            using (CPUOrGPUProfilerModule.setSelectionIntegrityCheckMarker.Auto())
            {
                // this could've come from anywhere, check the inputs first
                if (string.IsNullOrEmpty(markerNameOrMarkerNamePath))
                {
                    throw new ArgumentException($"{nameof(markerNameOrMarkerNamePath)} can't be null or empty. Hint: To clear a selection, use {nameof(IProfilerFrameTimeViewSampleSelectionController.ClearSelection)} instead.");
                }

                if (frameIndex == FrameDataView.invalidOrCurrentFrameIndex)
                {
                    frameIndex = iController.GetActiveVisibleFrameIndexOrLatestFrameForSettingTheSelection();
                }

                var threadIndex = CPUOrGPUProfilerModule.IntegrityCheckFrameAndThreadDataOfSelection(frameIndex, threadGroupName, threadName, ref threadId);

                int    lastSlashIndex = markerNameOrMarkerNamePath.LastIndexOf('/');
                string sampleName     = lastSlashIndex == -1 ? markerNameOrMarkerNamePath : markerNameOrMarkerNamePath.Substring(lastSlashIndex + 1, markerNameOrMarkerNamePath.Length - (lastSlashIndex + 1));

                if (lastSlashIndex == -1)// no path provided? just find the first sample
                {
                    markerNameOrMarkerNamePath = null;
                }

                int selectedSampleRawIndex = iController.FindMarkerPathAndRawSampleIndexToFirstMatchingSampleInCurrentView((int)frameIndex, 0, sampleName, out markerIdPath, markerNameOrMarkerNamePath);

                if (selectedSampleRawIndex < 0)
                {
                    return(false);
                }

                selection = new ProfilerTimeSampleSelection(frameIndex, threadGroupName, threadName, threadId, selectedSampleRawIndex, sampleName);
            }
            using (CPUOrGPUProfilerModule.setSelectionApplyMarker.Auto())
            {
                // looks good, apply
                selection.frameIndexIsSafe = true;
                iController.SetSelectionWithoutIntegrityChecks(selection, markerIdPath);
                return(true);
            }
        }
Esempio n. 3
0
        // selects first occurence of this sample in the given frame and thread (and optionally given the markerNamePath leading up to it or a (grand, (grand)...) parent of it)
        public static bool SetSelection(this IProfilerFrameTimeViewSampleSelectionController controller, long frameIndex, string threadGroupName, string threadName, string sampleName, string markerNamePath = null, ulong threadId = FrameDataView.invalidThreadId)
        {
            var iController = controller as IProfilerFrameTimeViewSampleSelectionControllerInternal;

            if (controller == null || iController == null)
            {
                throw new ArgumentNullException($"{nameof(controller)}", $"The IProfilerFrameTimeViewSampleSelectionController you are setting a selection on can't be null.");
            }

            ProfilerTimeSampleSelection selection;
            List <int> markerIdPath;

            using (CPUOrGPUProfilerModule.setSelectionIntegrityCheckMarker.Auto())
            {
                // this could've come from anywhere, check the inputs first
                if (string.IsNullOrEmpty(sampleName))
                {
                    throw new ArgumentException($"{nameof(sampleName)} can't be null or empty. Hint: To clear a selection, use {nameof(IProfilerFrameTimeViewSampleSelectionController.ClearSelection)} instead.");
                }


                var threadIndex = CPUOrGPUProfilerModule.IntegrityCheckFrameAndThreadDataOfSelection(frameIndex, threadGroupName, threadName, ref threadId);

                int selectedSampleRawIndex = iController.FindMarkerPathAndRawSampleIndexToFirstMatchingSampleInCurrentView((int)frameIndex, threadIndex, sampleName, out markerIdPath, markerNamePath);

                if (selectedSampleRawIndex < 0)
                {
                    return(false);
                }

                selection = new ProfilerTimeSampleSelection(frameIndex, threadGroupName, threadName, threadId, selectedSampleRawIndex, sampleName);
            }
            using (CPUOrGPUProfilerModule.setSelectionApplyMarker.Auto())
            {
                // looks good, apply
                selection.frameIndexIsSafe = true;
                iController.SetSelectionWithoutIntegrityChecks(selection, markerIdPath);
                return(true);
            }
        }
 public override void OnEnable(CPUOrGPUProfilerModule cpuOrGpuProfilerModule, ProfilerFrameDataHierarchyView profilerFrameDataHierarchyView)
 {
     base.OnEnable(cpuOrGpuProfilerModule, profilerFrameDataHierarchyView);
 }
Esempio n. 5
0
 public virtual void OnEnable(CPUOrGPUProfilerModule cpuOrGpuProfilerModule, ProfilerFrameDataHierarchyView profilerFrameDataHierarchyView)
 {
     m_CPUOrGPUProfilerModule         = cpuOrGpuProfilerModule;
     m_ProfilerFrameDataHierarchyView = profilerFrameDataHierarchyView;
 }
Esempio n. 6
0
 public virtual void OnEnable(CPUOrGPUProfilerModule cpuOrGpuModule, IProfilerWindowController profilerWindow, bool isGpuView)
 {
     m_ProfilerWindow = profilerWindow;
     cpuModule        = cpuOrGpuModule;
     gpuView          = isGpuView;
 }