Example #1
0
        protected override void Run()
        {
            //TODO: patch the FileSelectorDialog to allow specific addin paths to be used ?

            FileChooserDialog dlg = new FileChooserDialog(
                GettextCatalog.GetString("Select Executable"), null, FileChooserAction.Open,
                "gtk-cancel", ResponseType.Cancel,
                "gtk-open", ResponseType.Accept
                );

            dlg.SelectMultiple = false;
            dlg.LocalOnly      = true;
            dlg.Modal          = true;
            dlg.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.Personal));

            FileFilter filterAll = new FileFilter();

            filterAll.AddPattern("*");
            filterAll.Name = GettextCatalog.GetString("All files");
            dlg.AddFilter(filterAll);

            if (dlg.Run() == (int)ResponseType.Accept)
            {
                ProfilingService.LoadSnapshot(dlg.Filename);
            }
            dlg.Destroy();
        }
Example #2
0
        public void Load()
        {
            XmlDocument doc = new XmlDocument();

            if (!File.Exists(filename))
            {
                return;
            }

            try {
                doc.Load(filename);

                foreach (XmlNode node in doc.DocumentElement.SelectNodes("ProfilingSnapshot"))
                {
                    if (node.NodeType != XmlNodeType.Element)
                    {
                        continue;
                    }

                    XmlElement element = node as XmlElement;
                    ProfilingService.LoadSnapshot(element.GetAttribute("profiler"), element.GetAttribute("filename"));
                }
            } catch (Exception e) {
                LoggingService.LogError("ProfilingSnapshotCollection", "Load Profiling Snapshots", e);
            }
        }
        public override IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console)
        {
            DummyProcessAsyncOperation dpao = new DummyProcessAsyncOperation(process);
            string profilerIdentifier, tempFile, snapshotFile;

            ProfilingService.GetProfilerInformation(process.Id, out profilerIdentifier, out tempFile);
            DotNetExecutionCommand dotcmd = (DotNetExecutionCommand)command;

            snapshotFile = profiler.GetSnapshotFileName(dotcmd.WorkingDirectory, tempFile);

            ProfilingService.ActiveProfiler = profiler;
            ProfilingContext profContext = new ProfilingContext(dpao, snapshotFile);

            profiler.Start(profContext);

            return(dpao);
        }
        public static IAsyncOperation ProfileProcess(IProfiler profiler, Process process)
        {
            if (IdeApp.ProjectOperations.CurrentRunOperation != null &&
                !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                return(IdeApp.ProjectOperations.CurrentRunOperation);
            }

            SwitchWorkbenchContext(ProfileWorkbenchContext);

            string                 workingDir = ProfilingService.GetProcessDirectory(process.Id);
            IExecutionHandler      handler    = profiler.GetProcessExecutionHandlerFactory(process);
            DotNetExecutionCommand cmd        = new DotNetExecutionCommand();

            cmd.WorkingDirectory = workingDir;
            return(handler.Execute(cmd, null /*context.ConsoleFactory.CreateConsole (true)*/));
        }
 private void ListProcessesAsync(object state)
 {
     foreach (Process proc in Process.GetProcesses())
     {
         string profiler;
         string filename;
         if (ProfilingService.GetProfilerInformation(proc.Id, out profiler, out filename))
         {
             IProfiler prof = ProfilingService.GetProfiler(profiler);
             if (prof != null && prof.IsSupported)
             {
                 DispatchService.GuiDispatch(delegate() {
                     store.AppendValues(proc.ProcessName, prof.Name, profiler, proc.Id.ToString(), proc);
                 });
             }
         }
     }
 }