static void RecordToggle(CommandExecuteContext context)
            {
                if (ProcessService.level == ProcessLevel.UMP_MASTER &&
                    ProcessService.IsChannelServiceStarted() &&
                    ProcessService.GetSlaveProcessState(s_SlaveProcessId) == ProcessState.UMP_RUNNING &&
                    EventService.IsConnected)
                {
                    EventService.Request(nameof(EventType.UmpProfilerRecordToggle), (err, args) =>
                    {
                        bool recording = false;
                        if (err == null)
                        {
                            // Recording was toggled by profiler OOP
                            recording = (bool)args[0];
                            ProfilerDriver.enabled = recording;
                        }
                        else
                        {
                            if (!EditorWindow.HasOpenInstances <ProfilerWindow>())
                            {
                                return;
                            }

                            // Toggle profiling in-process
                            recording = !ProfilerDriver.enabled;
                            ProfilerDriver.profileEditor = !EditorApplication.isPlaying;
                            var profilerWindow           = EditorWindow.GetWindow <ProfilerWindow>();
                            if (profilerWindow)
                            {
                                profilerWindow.SetRecordingEnabled(recording);
                            }
                            else
                            {
                                ProfilerDriver.enabled = recording;
                            }
                        }

                        if (recording)
                        {
                            Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Recording has started...");
                        }
                        else
                        {
                            Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, "Recording has ended.");
                        }
                    }, 250);

                    context.result = true;
                }
                else
                {
                    context.result = false;
                }
            }
Exemple #2
0
        private static object ExecuteCommand(string id, CommandHint hint, object[] args)
        {
            if (!Exists(id))
            {
                throw new ArgumentException($"Command {id} does not exist", nameof(id));
            }

            var command = s_Commands[id];

            if ((command.hint & hint) == 0)
            {
                throw new ArgumentException($"Command ({id}, {command.hint}) does not match the hinting {hint}", nameof(id));
            }

            var context = new CommandExecuteContext {
                hint = hint, args = args, result = null
            };

            command.handler(context);
            return(context.result);
        }
 internal static void Refresh(CommandExecuteContext c)
 {
     LoadModes();
 }
Exemple #4
0
 static void OnEnableDeepProfilingCommand(CommandExecuteContext ctx)
 {
     OnProfilerWindowDeepProfileChanged(ProfilerDriver.deepProfiling);
 }
Exemple #5
0
 static void OnRecordCommand(CommandExecuteContext ctx)
 {
     s_SlaveProfilerWindow.SetRecordingEnabled(!s_SlaveProfilerWindow.IsRecording());
     Menu.SetChecked("Edit/Record", s_SlaveProfilerWindow.IsRecording());
 }
Exemple #6
0
 static void OnSaveProfileDataFileCommand(CommandExecuteContext ctx)
 {
     s_SlaveProfilerWindow.SaveProfilingData();
 }
Exemple #7
0
 static void OnLoadProfileDataFileCommand(CommandExecuteContext ctx)
 {
     s_SlaveProfilerWindow.LoadProfilingData(false);
 }
Exemple #8
0
 [UsedImplicitly, RequiredSignature] static void RequiredSignature(CommandExecuteContext context)
 {
 }
Exemple #9
0
 internal static void TryForceExitSafeModeMenu(CommandExecuteContext context)
 {
     TryForceExitSafeMode();
 }