コード例 #1
0
 void OnGUI()
 {
     if (_methods.Count == 0)
     {
         GUILayout.Label("Select runner:");
         Runner = EditorGUILayout.ObjectField(Runner, typeof(UnityBenchmarkRunner), true) as UnityBenchmarkRunner;
         if (Runner)
         {
             _methods = Runner.CreateRunners().SelectMany(r => r.GetAllMethodNames()).ToList();
         }
     }
     else
     {
         GUILayout.Label($"Loaded {_methods.Count} methods");
         if (_recorder == null)
         {
             if (GUILayout.Button("Record"))
             {
                 StartRecording();
             }
         }
         else
         {
             if (GUILayout.Button("Stop"))
             {
                 _recorder = null;
             }
         }
         if (GUILayout.Button("Clear"))
         {
             Runner = null;
             _methods.Clear();
         }
     }
 }
コード例 #2
0
 void Update()
 {
     if (_recorder != null)
     {
         var done = _recorder.Update();
         if (done)
         {
             Debug.LogFormat("Recordered {0} results ", _recorder.Results.Count);
             _recorder = null;
         }
     }
 }
コード例 #3
0
 public void StartRecording()
 {
     _recorder = new ProfilerRecorder(_methods);
 }