Example #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 (); };
 }
        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;
        }
Example #3
0
 public ProfileSetupDialog(Gtk.Window parent)
     : base("Profile Options", parent, DialogFlags.DestroyWithParent, Stock.Cancel, ResponseType.Cancel, Stock.Execute, ResponseType.Accept)
 {
     config = new ProfileConfiguration ();
     HBox box = new HBox (false, 6);
     box.PackStart (new Label ("Application:"), false, false, 0);
     FileChooserButton target_button = new FileChooserButton ("Select Application", FileChooserAction.Open);
     FileFilter filter = new FileFilter ();
     filter.AddPattern ("*.exe");
     filter.AddPattern ("*.aspx");
     target_button.Filter = filter;
     target_button.SelectionChanged += delegate {
         config.TargetPath = target_button.Filename;
         SetResponseSensitive (ResponseType.Accept, !String.IsNullOrEmpty (target_button.Filename));
     };
     box.PackStart (target_button, true, true, 0);
     box.ShowAll ();
     VBox.PackStart (box, false, false, 3);
     Widget editor = new ProfileOptionsEditor (config);
     editor.ShowAll ();
     VBox.PackStart (editor, false, false, 3);
     SetResponseSensitive (ResponseType.Accept, false);
 }
Example #4
0
 public ProfileOptionsEditor(ProfileConfiguration config)
     : base(false, 0)
 {
     this.config = config;
     HBox box = new HBox (false, 6);
     box.PackStart (new Label ("Type:"), false, false, 0);
     ComboBox type_combo = ComboBox.NewText ();
     type_combo.AppendText ("Allocations");
     type_combo.AppendText ("Calls/Instrumented");
     type_combo.AppendText ("Statistical");
     type_combo.Active = 1;
     config.Mode = ProfileMode.Instrumented;
     type_combo.Changed += delegate { config.Mode = (ProfileMode) (1 << type_combo.Active); };
     box.PackStart (type_combo, false, false, 0);
     box.ShowAll ();
     PackStart (box, false, false, 3);
     box = new HBox (false, 6);
     CheckButton start_enabled_chkbtn = new CheckButton ("Enabled at Startup");
     start_enabled_chkbtn.Active = true;
     start_enabled_chkbtn.Toggled += delegate { config.StartEnabled = start_enabled_chkbtn.Active; };
     box.PackStart (start_enabled_chkbtn, false, false, 0);
     box.ShowAll ();
     PackStart (box, false, false, 3);
 }
Example #5
0
 public ProfilerProcess(ProfileConfiguration config)
     : this(config, new Process ())
 {
 }
Example #6
0
 public StartEventArgs(ProfileConfiguration config)
 {
     this.type = StartEventType.Repeat;
     this.config = config;
 }
Example #7
0
 public QuickStartItem(StartPage owner, ProfileConfiguration config, string caption, string description, int x, int y)
     : base(owner, caption, description, x, y)
 {
     this.config = config;
 }
Example #8
0
 void StartProfile(ProfileConfiguration config)
 {
     ProfileView view = new ProfileView ();
     view.Show ();
     View = view;
     logging_enabled_action.Visible = true;
     logging_enabled_action.Active = config.StartEnabled;
     proc = new ProfilerProcess (config);
     proc.Paused += delegate { Refresh (view); };
     proc.Exited += delegate { Refresh (view); logging_enabled_action.Visible = false; };
     proc.Start ();
     if (config.TargetPath.EndsWith (".aspx"))
         GLib.Timeout.Add (5000, delegate { ShowBrowser (config.TargetPath); return false; });
     log_info = new LogInfo (proc.LogFile, config.ToString ());
     history.LogFiles.Prepend (log_info);
     history.Configs.Prepend (config);
 }
Example #9
0
 public void Prepend(ProfileConfiguration config)
 {
     list.Remove (config);
     list.Insert (0, config);
     while (list.Count > max_items)
         list.RemoveAt (max_items);
     OnChanged ();
 }