Example #1
0
        static Result EndExperiment(string experimentName)
        {
            if (string.IsNullOrEmpty(experimentName))
            {
                Debug.LogError("Unable to end experiment. Name cannot be null or empty.");
                return(null);
            }

            if (!_results.ContainsKey(experimentName))
            {
                Debug.LogErrorFormat("Unable to end experiment. Experiment with name '{0}' not found.", experimentName);
            }

            Debug.Log("Ending Experiment: " + experimentName);

            var xpm = _results[experimentName];

            xpm.lastFrameNumber  = DataSource.frameCount;
            xpm.realtimeAtStop   = DataSource.realtimeSinceStartup;
            xpm.memoryUsageAtEnd = DataSource.memoryAllocated;

            if (ProfilerControl != null && ProfilerControl.recording)
            {
                ProfilerControl.StopRecording();
            }

#if !PERF_DEV_PREVIEW
            _experimentName = null;
#endif

            return(xpm);
        }
Example #2
0
        private static Result EndExperiment(string experimentName)
        {
            if (string.IsNullOrEmpty(experimentName))
            {
                UnityEngine.Debug.LogError("Unable to end experiment. Name cannot be null or empty.");
                return(null);
            }
            if (!_results.ContainsKey(experimentName))
            {
                UnityEngine.Debug.LogErrorFormat("Unable to end experiment. Experiment with name '{0}' not found.", experimentName);
            }
            Result result = _results[experimentName];

            result.lastFrameNumber  = DataSource.frameCount;
            result.realtimeAtStop   = DataSource.realtimeSinceStartup;
            result.memoryUsageAtEnd = DataSource.memoryAllocated;
            if (ProfilerControl != null && ProfilerControl.recording)
            {
                ProfilerControl.StopRecording();
            }
            _experimentName = null;
            return(result);
        }