Exemplo n.º 1
0
 public ProfilerProcess(ProfileConfiguration config, Process proc)
 {
     log_file = System.IO.Path.GetTempFileName () + ".mprof";
     this.proc = proc;
     socket = new ProfilerSocket ();
     socket.Paused += delegate { OnPaused (); };
     if (config.TargetPath.EndsWith (".exe")) {
         proc.StartInfo.FileName = "mono";
         proc.StartInfo.Arguments = "--profile=logging:" + config.ToArgs () + ",o=" + log_file + ",cp=" + socket.Port.ToString () + " " + config.TargetPath;
     } else if (config.TargetPath.EndsWith (".aspx")) {
         proc.StartInfo.FileName = "xsp2";
         proc.StartInfo.EnvironmentVariables.Add ("MONO_OPTIONS", "--profile=logging:" + config.ToArgs () + ",o=" + log_file + ",cp=" + socket.Port.ToString ());
         proc.StartInfo.Arguments = "--nonstop --port 8080 --root " + System.IO.Path.GetDirectoryName (config.TargetPath);
         proc.StartInfo.UseShellExecute = false;
     }
     proc.EnableRaisingEvents = true;
     proc.Exited += delegate { OnExited (); };
 }
Exemplo n.º 2
0
        public override IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console, CommandExecutionContext ctx, object config_data)
        {
            DotNetExecutionCommand dnec = command as DotNetExecutionCommand;

            ProfileConfiguration config = new ProfileConfiguration ();
            config.TargetPath = command.CommandString;
            ProfilerExecutionOptions options = config_data as ProfilerExecutionOptions;
            if (options != null) {
                config.StartEnabled = options.StartEnabled;
                config.Mode = options.Mode;
            }

            string logfile = System.IO.Path.GetTempFileName () + ".mprof";
            ProfilerSocket socket = new ProfilerSocket ();
            ProfilerViewContent view = new ProfilerViewContent ();
            socket.Paused += delegate { view.Load (logfile); };
            dnec.RuntimeArguments += String.Format (" --profile=logging:{0},o={1},cp={2}", config.ToArgs (), logfile, socket.Port);
            IExecutionHandler h = Runtime.ProcessService.GetDefaultExecutionHandler (command);
            IProcessAsyncOperation result = h.Execute (command, console);
            result.Completed += delegate { view.Load (logfile); };
            Gtk.Application.Invoke (delegate { IdeApp.Workbench.OpenDocument (view, true); });
            return result;
        }