Ejemplo n.º 1
0
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true)
        {
            ThreadHelper.JoinableTaskFactory.Run(async() => {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                if (!Utilities.SaveDirtyFiles())
                {
                    // Abort
                    return;
                }

                if (target.ProjectTarget != null)
                {
                    ProfileProjectTarget(session, target.ProjectTarget, openReport);
                }
                else if (target.StandaloneTarget != null)
                {
                    ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
                }
                else
                {
                    if (MessageBox.Show(Strings.ProfilingSessionNotConfigured, Strings.NoProfilingTargetTitle, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        var newTarget = session.OpenTargetProperties();
                        if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null))
                        {
                            StartProfiling(newTarget, session, openReport);
                        }
                    }
                }
            });
        }
Ejemplo n.º 2
0
        internal SessionNode OpenTarget(ProfilingTarget target, string filename)
        {
            for (int i = 0; i < _sessions.Count; i++)
            {
                if (_sessions[i].Filename == filename)
                {
                    throw new InvalidOperationException(Strings.PerformanceSessionAlreadyOpen.FormatUI(filename));
                }
            }

            uint prevSibl;

            if (_sessions.Count > 0)
            {
                prevSibl = _sessions[_sessions.Count - 1].ItemId;
            }
            else
            {
                prevSibl = VSConstants.VSITEMID_NIL;
            }

            var node = new SessionNode(_serviceProvider, this, target, filename);

            _sessions.Add(node);

            OnItemAdded(VSConstants.VSITEMID_ROOT, prevSibl, node.ItemId);

            if (_activeSession == VSConstants.VSITEMID_NIL)
            {
                SetActiveSession(node);
            }

            return(node);
        }
Ejemplo n.º 3
0
        public SessionNode(IServiceProvider serviceProvider, SessionsNode parent, ProfilingTarget target, string filename) {
            _serviceProvider = serviceProvider;
            _parent = parent;
            _target = target;
            _filename = filename;

            // Register this with the running document table.  This will prompt
            // for save when the file is dirty and by responding to GetProperty
            // for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of
            // our files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            var rdt = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable));
            Debug.Assert(rdt != null, "_serviceProvider has no RDT service");
            uint cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);
            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument(
                    (uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory),
                    filename,
                    this,
                    VSConstants.VSITEMID_ROOT,
                    punkDocData,
                    out cookie
                ));
            } finally {
                if (punkDocData != IntPtr.Zero) {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;

            ItemId = parent._sessionsCollection.Add(this);
        }
Ejemplo n.º 4
0
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true)
        {
            ThreadHelper.Generic.Invoke(() => {
                if (!Utilities.SaveDirtyFiles())
                {
                    // Abort
                    return;
                }

                if (target.ProjectTarget != null)
                {
                    ProfileProjectTarget(session, target.ProjectTarget, openReport);
                }
                else if (target.StandaloneTarget != null)
                {
                    ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
                }
                else
                {
                    if (MessageBox.Show("Profiling session is not configured - would you like to configure now and then launch?", "No Profiling Target", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        var newTarget = session.OpenTargetProperties();
                        if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null))
                        {
                            StartProfiling(newTarget, session, openReport);
                        }
                    }
                }
            });
        }
Ejemplo n.º 5
0
        IPythonProfileSession IPythonProfiling.LaunchProcess(string interpreter, string script, string workingDir, string arguments, bool openReport)
        {
            var target = new ProfilingTarget();

            target.StandaloneTarget = new StandaloneTarget();
            target.StandaloneTarget.WorkingDirectory = workingDir;
            target.StandaloneTarget.Script           = script;
            target.StandaloneTarget.Arguments        = arguments;

            if (interpreter.IndexOfAny(Path.GetInvalidPathChars()) == -1 && File.Exists(interpreter))
            {
                target.StandaloneTarget.InterpreterPath = interpreter;
            }
            else
            {
                string[] interpreterInfo = interpreter.Split(new[] { ';' }, 2);
                Guid     interpreterGuid;
                Version  interpreterVersion;
                if (interpreterInfo.Length == 2 &&
                    Guid.TryParse(interpreterInfo[0], out interpreterGuid) &&
                    Version.TryParse(interpreterInfo[1], out interpreterVersion))
                {
                    target.StandaloneTarget.PythonInterpreter         = new PythonInterpreter();
                    target.StandaloneTarget.PythonInterpreter.Id      = interpreterGuid;
                    target.StandaloneTarget.PythonInterpreter.Version = interpreterVersion.ToString();
                }
                else
                {
                    throw new InvalidOperationException(String.Format("Invalid interpreter: {0}", interpreter));
                }
            }

            return(PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject());
        }
Ejemplo n.º 6
0
        public IPythonProfileSession LaunchProcess(string interpreter, string script, string workingDir, string arguments, bool openReport) {
            var target = new ProfilingTarget();
            target.StandaloneTarget = new StandaloneTarget();
            target.StandaloneTarget.WorkingDirectory = workingDir;
            target.StandaloneTarget.Script = script;
            target.StandaloneTarget.Arguments = arguments;

            if (File.Exists(interpreter)) {
                target.StandaloneTarget.InterpreterPath = interpreter;
            } else {
                string[] interpreterInfo = interpreter.Split(new[] { ';' }, 2);
                Guid interpreterGuid;
                Version interpreterVersion;
                if (interpreterInfo.Length == 2 &&
                    Guid.TryParse(interpreterInfo[0], out interpreterGuid) &&
                    Version.TryParse(interpreterInfo[1], out interpreterVersion)) {
                    target.StandaloneTarget.PythonInterpreter = new PythonInterpreter();
                    target.StandaloneTarget.PythonInterpreter.Id = interpreterGuid;
                    target.StandaloneTarget.PythonInterpreter.Version = interpreterVersion.ToString();
                } else {
                    throw new InvalidOperationException(String.Format("Invalid interpreter: {0}", interpreter));
                }
            }

            return PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject();
        }
Ejemplo n.º 7
0
        internal SessionNode OpenTarget(ProfilingTarget target, string filename)
        {
            for (int i = 0; i < _sessions.Count; i++)
            {
                if (_sessions[i].Filename == filename)
                {
                    throw new InvalidOperationException(String.Format("Performance '{0}' session is already open", filename));
                }
            }

            uint itemid = (uint)_sessions.Count;
            var  node   = new SessionNode(this, target, filename);

            _sessions.Add(node);

            uint prevSibl;

            if (itemid != 0)
            {
                prevSibl = itemid - 1;
            }
            else
            {
                prevSibl = VSConstants.VSITEMID_NIL;
            }

            OnItemAdded(VSConstants.VSITEMID_ROOT, prevSibl, itemid);

            if (_activeSession == -1)
            {
                SetActiveSession(node);
            }

            return(node);
        }
Ejemplo n.º 8
0
        public IPythonProfileSession LaunchProject(EnvDTE.Project projectToProfile, bool openReport) {
            var target = new ProfilingTarget();
            target.ProjectTarget = new ProjectTarget();
            target.ProjectTarget.TargetProject = new Guid(projectToProfile.Properties.Item("Guid").Value as string);
            target.ProjectTarget.FriendlyName = projectToProfile.Name;

            return PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject();
        }
Ejemplo n.º 9
0
        internal SessionNode ProfileTarget(ProfilingTarget target, bool openReport = true)
        {
            bool   save;
            string name    = target.GetProfilingName(this, out save);
            var    session = ShowPerformanceExplorer().Sessions.AddTarget(target, name, save);

            StartProfiling(target, session, openReport);
            return(session);
        }
Ejemplo n.º 10
0
        public IPythonProfileSession LaunchProject(EnvDTE.Project projectToProfile, bool openReport)
        {
            var target = new ProfilingTarget();

            target.ProjectTarget = new ProjectTarget();
            target.ProjectTarget.TargetProject = new Guid(projectToProfile.Properties.Item("Guid").Value as string);
            target.ProjectTarget.FriendlyName  = projectToProfile.Name;

            return(PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject());
        }
Ejemplo n.º 11
0
        public LaunchProfiling()
        {
            _target = new ProfilingTarget();
            InitializeComponent();

            /*
             * if (availableProjects.Count == 0) {
             *  _profileProject.IsEnabled = false;
             * }*/
        }
Ejemplo n.º 12
0
        internal SessionNode AddTarget(ProfilingTarget target, string filename, bool save)
        {
            Debug.Assert(filename.EndsWithOrdinal(".pyperf", ignoreCase: true));

            // ensure a unique name
            string newBaseName  = Path.GetFileNameWithoutExtension(filename);
            string tempBaseName = newBaseName;
            int    append       = 0;
            bool   dupFound;

            do
            {
                dupFound = false;
                for (int i = 0; i < _sessions.Count; i++)
                {
                    if (Path.GetFileNameWithoutExtension(_sessions[i].Filename) == newBaseName)
                    {
                        dupFound = true;
                    }
                }
                if (dupFound)
                {
                    append++;
                    newBaseName = tempBaseName + append;
                }
            } while (dupFound);

            string newFilename = newBaseName + ".pyperf";
            // add directory name back if present...
            string dirName = Path.GetDirectoryName(filename);

            if (!string.IsNullOrEmpty(dirName))
            {
                newFilename = Path.Combine(dirName, newFilename);
            }
            filename = newFilename;

            // save to the unique item if desired (we save whenever we have an active solution as we have a place to put it)...
            if (save)
            {
                using (var fs = new FileStream(filename, FileMode.Create)) {
                    ProfilingTarget.Serializer.Serialize(fs, target);
                }
            }

            var node = OpenTarget(target, filename);

            if (!save)
            {
                node.MarkDirty();
                node._neverSaved = true;
            }

            return(node);
        }
Ejemplo n.º 13
0
        internal SessionNode ProfileTarget(ProfilingTarget target, bool openReport = true)
        {
            return(ThreadHelper.Generic.Invoke(() => {
                bool save;
                string name = target.GetProfilingName(this, out save);
                var session = ShowPerformanceExplorer().Sessions.AddTarget(target, name, save);

                StartProfiling(target, session, openReport);
                return session;
            }));
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Create a ProfilingTargetView with values taken from a template.
 /// </summary>
 public ProfilingTargetView(IServiceProvider serviceProvider, ProfilingTarget template)
     : this(serviceProvider) {
     if (template.ProjectTarget != null) {
         Project = new ProjectTargetView(template.ProjectTarget);
         IsStandaloneSelected = false;
         IsProjectSelected = true;
     } else if (template.StandaloneTarget != null) {
         Standalone = new StandaloneTargetView(serviceProvider, template.StandaloneTarget);
         IsProjectSelected = false;
         IsStandaloneSelected = true;
     }
     _startText = "_OK";
 }
Ejemplo n.º 15
0
 internal static bool IsSame(ProfilingTarget self, ProfilingTarget other)
 {
     if (self == null)
     {
         return(other == null);
     }
     else if (other != null)
     {
         return(ProjectTarget.IsSame(self.ProjectTarget, other.ProjectTarget) &&
                StandaloneTarget.IsSame(self.StandaloneTarget, other.StandaloneTarget));
     }
     return(false);
 }
Ejemplo n.º 16
0
        internal SessionNode ProfileTarget(ProfilingTarget target, bool openReport = true)
        {
            return(ThreadHelper.JoinableTaskFactory.Run(async() => {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                bool save;
                string name = target.GetProfilingName(this, out save);
                var session = ShowPerformanceExplorer().Sessions.AddTarget(target, name, save);

                StartProfiling(target, session, openReport);
                return session;
            }));
        }
Ejemplo n.º 17
0
        public LaunchProfiling(ProfilingTarget target)
        {
            _target = target;
            InitializeComponent();

            if (_target.ProjectTarget != null)
            {
                _profileProject.IsChecked = true;
                for (int i = 0; i < Projects.Count; i++)
                {
                    var project = Projects[i];
                    if (project.Guid == target.ProjectTarget.TargetProject)
                    {
                        _project.SelectedIndex = i;
                        break;
                    }
                }
            }
            else if (_target.StandaloneTarget != null)
            {
                _profileScript.IsChecked = true;
                if (_target.StandaloneTarget.PythonInterpreter != null)
                {
                    var     guid = _target.StandaloneTarget.PythonInterpreter.Id;
                    Version version;
                    if (Version.TryParse(_target.StandaloneTarget.PythonInterpreter.Version, out version))
                    {
                        for (int i = 0; i < InterpreterFactories.Count; i++)
                        {
                            var fact = InterpreterFactories[i];
                            if (fact.Id == guid && fact.Version == version)
                            {
                                _pythonInterpreter.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    _pythonInterpreter.Text = _target.StandaloneTarget.InterpreterPath ?? "";
                }

                _scriptName.Text  = _target.StandaloneTarget.Script ?? "";
                _workingDir.Text  = _target.StandaloneTarget.WorkingDirectory ?? "";
                _cmdLineArgs.Text = _target.StandaloneTarget.Arguments ?? "";
            }
        }
Ejemplo n.º 18
0
        internal ProfilingTarget Clone() {
            var res = new ProfilingTarget();
            if (ProjectTarget != null) {
                res.ProjectTarget = ProjectTarget.Clone();
            }

            if (StandaloneTarget != null) {
                res.StandaloneTarget = StandaloneTarget.Clone();
            }

            if (Reports != null) {
                res.Reports = Reports.Clone();
            }

            return res;
        }
Ejemplo n.º 19
0
        public IPythonProfileSession LaunchProcess(string interpreter, string script, string workingDir, string arguments, bool openReport) {
            var target = new ProfilingTarget();
            target.StandaloneTarget = new StandaloneTarget();
            target.StandaloneTarget.WorkingDirectory = workingDir;
            target.StandaloneTarget.Script = script;
            target.StandaloneTarget.Arguments = arguments;

            if (File.Exists(interpreter)) {
                target.StandaloneTarget.InterpreterPath = interpreter;
            } else {
                target.StandaloneTarget.PythonInterpreter = new PythonInterpreter();
                target.StandaloneTarget.PythonInterpreter.Id = interpreter;
            }

            return PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject();
        }
Ejemplo n.º 20
0
        internal ProfilingTarget OpenTargetProperties()
        {
            var tempTarget = _target.Clone();
            var dialog     = new LaunchProfiling(tempTarget);
            var res        = dialog.ShowDialog();

            if (res != null && res.Value)
            {
                if (!ProfilingTarget.IsSame(tempTarget, _target))
                {
                    _target = dialog.Target;
                    MarkDirty();
                    return(dialog.Target);
                }
            }
            return(null);
        }
Ejemplo n.º 21
0
        internal SessionNode AddTarget(ProfilingTarget target, string filename, bool save) {
            Debug.Assert(filename.EndsWith(".pyperf"));

            // ensure a unique name
            string newBaseName = Path.GetFileNameWithoutExtension(filename);
            string tempBaseName = newBaseName;
            int append = 0;
            bool dupFound;
            do {
                dupFound = false;
                for (int i = 0; i < _sessions.Count; i++) {
                    if (Path.GetFileNameWithoutExtension(_sessions[i].Filename) == newBaseName) {
                        dupFound = true;
                    }
                }
                if (dupFound) {
                    append++;
                    newBaseName = tempBaseName + append;
                }
            } while (dupFound);

            string newFilename = newBaseName + ".pyperf";
            // add directory name back if present...
            string dirName = Path.GetDirectoryName(filename);
            if (dirName != "") {
                newFilename = Path.Combine(dirName, newFilename);
            }
            filename = newFilename;

            // save to the unique item if desired (we save whenever we have an active solution as we have a place to put it)...
            if (save) {
                using (var fs = new FileStream(filename, FileMode.Create)) {
                    ProfilingTarget.Serializer.Serialize(fs, target);
                }
            }

            var node = OpenTarget(target, filename);

            if (!save) {
                node.MarkDirty();
                node._neverSaved = true;
            }

            return node;
        }
Ejemplo n.º 22
0
        internal ProfilingTarget OpenTargetProperties()
        {
            var targetView = new ProfilingTargetView(_serviceProvider, _target);
            var dialog     = new LaunchProfiling(_serviceProvider, targetView);
            var res        = dialog.ShowModal() ?? false;

            if (res && targetView.IsValid)
            {
                var target = targetView.GetTarget();
                if (target != null && !ProfilingTarget.IsSame(target, _target))
                {
                    _target = target;
                    MarkDirty();
                    return(_target);
                }
            }
            return(null);
        }
Ejemplo n.º 23
0
        public IPythonProfileSession LaunchProcess(string interpreter, string script, string workingDir, string arguments, bool openReport)
        {
            var target = new ProfilingTarget();

            target.StandaloneTarget = new StandaloneTarget();
            target.StandaloneTarget.WorkingDirectory = workingDir;
            target.StandaloneTarget.Script           = script;
            target.StandaloneTarget.Arguments        = arguments;

            if (File.Exists(interpreter))
            {
                target.StandaloneTarget.InterpreterPath = interpreter;
            }
            else
            {
                target.StandaloneTarget.PythonInterpreter    = new PythonInterpreter();
                target.StandaloneTarget.PythonInterpreter.Id = interpreter;
            }

            return(PythonProfilingPackage.Instance.ProfileTarget(target, openReport).GetAutomationObject());
        }
Ejemplo n.º 24
0
        internal ProfilingTarget Clone()
        {
            var res = new ProfilingTarget();

            if (ProjectTarget != null)
            {
                res.ProjectTarget = ProjectTarget.Clone();
            }

            if (StandaloneTarget != null)
            {
                res.StandaloneTarget = StandaloneTarget.Clone();
            }

            if (Reports != null)
            {
                res.Reports = Reports.Clone();
            }

            return(res);
        }
Ejemplo n.º 25
0
 internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true)
 {
     if (target.ProjectTarget != null)
     {
         ProfileProjectTarget(session, target.ProjectTarget, openReport);
     }
     else if (target.StandaloneTarget != null)
     {
         ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
     }
     else
     {
         if (MessageBox.Show("Profiling session is not configured - would you like to configure now and then launch?", "No Profiling Target", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             var newTarget = session.OpenTargetProperties();
             if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null))
             {
                 StartProfiling(newTarget, session, openReport);
             }
         }
     }
 }
Ejemplo n.º 26
0
        public SessionNode(IServiceProvider serviceProvider, SessionsNode parent, ProfilingTarget target, string filename)
        {
            _serviceProvider = serviceProvider;
            _parent          = parent;
            _target          = target;
            _filename        = filename;

            // Register this with the running document table.  This will prompt
            // for save when the file is dirty and by responding to GetProperty
            // for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of
            // our files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            var rdt = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable));

            Debug.Assert(rdt != null, "_serviceProvider has no RDT service");
            uint   cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);

            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument(
                                                (uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory),
                                                filename,
                                                this,
                                                VSConstants.VSITEMID_ROOT,
                                                punkDocData,
                                                out cookie
                                                ));
            } finally {
                if (punkDocData != IntPtr.Zero)
                {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;

            ItemId = parent._sessionsCollection.Add(this);
        }
Ejemplo n.º 27
0
        public SessionNode(SessionsNode parent, ProfilingTarget target, string filename)
        {
            _parent   = parent;
            _target   = target;
            _filename = filename;

            // Register this with the running document table.  This will prompt for save when the file is dirty and
            // by responding to GetProperty for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of our
            // files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            IVsRunningDocumentTable rdt = PythonProfilingPackage.GetGlobalService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
            uint   cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);

            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument((uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory), filename, this, VSConstants.VSITEMID_ROOT, punkDocData, out cookie));
            } finally {
                if (punkDocData != IntPtr.Zero)
                {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;
        }
Ejemplo n.º 28
0
 internal static bool IsSame(ProfilingTarget self, ProfilingTarget other) {
     if (self == null) {
         return other == null;
     } else if (other != null) {
         return ProjectTarget.IsSame(self.ProjectTarget, other.ProjectTarget) &&
             StandaloneTarget.IsSame(self.StandaloneTarget, other.StandaloneTarget);
     }
     return false;
 }
Ejemplo n.º 29
0
        internal SessionNode ProfileTarget(ProfilingTarget target, bool openReport = true) {
            return ThreadHelper.Generic.Invoke(() => {
                bool save;
                string name = target.GetProfilingName(this, out save);
                var session = ShowPerformanceExplorer().Sessions.AddTarget(target, name, save);

                StartProfiling(target, session, openReport);
                return session;
            });
        }
Ejemplo n.º 30
0
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true) {
            ThreadHelper.Generic.Invoke(() => {
                if (!Utilities.SaveDirtyFiles()) {
                    // Abort
                    return;
                }

                if (target.ProjectTarget != null) {
                    ProfileProjectTarget(session, target.ProjectTarget, openReport);
                } else if (target.StandaloneTarget != null) {
                    ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
                } else {
                    if (MessageBox.Show("Profiling session is not configured - would you like to configure now and then launch?", "No Profiling Target", MessageBoxButton.YesNo) == MessageBoxResult.Yes) {
                        var newTarget = session.OpenTargetProperties();
                        if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null)) {
                            StartProfiling(newTarget, session, openReport);
                        }
                    }
                }
            });
        }
Ejemplo n.º 31
0
 public ProfilingTargetView(ProfilingTarget template)
     : this(PythonProfilingPackage.Instance, template)
 {
 }
Ejemplo n.º 32
0
 public ProfilingTargetView(ProfilingTarget template)
     : this(PythonProfilingPackage.Instance, template) {
 }
Ejemplo n.º 33
0
        internal SessionNode OpenTarget(ProfilingTarget target, string filename) {
            for (int i = 0; i < _sessions.Count; i++) {
                if (_sessions[i].Filename == filename) {
                    throw new InvalidOperationException(String.Format("Performance '{0}' session is already open", filename));
                }
            }

            uint prevSibl;
            if (_sessions.Count > 0) {
                prevSibl = _sessions[_sessions.Count - 1].ItemId;
            } else {
                prevSibl = VSConstants.VSITEMID_NIL;
            }

            var node = new SessionNode(_serviceProvider, this, target, filename);
            _sessions.Add(node);

            OnItemAdded(VSConstants.VSITEMID_ROOT, prevSibl, node.ItemId);

            if (_activeSession == VSConstants.VSITEMID_NIL) {
                SetActiveSession(node);
            }

            return node;
        }
Ejemplo n.º 34
0
 internal ProfilingTarget OpenTargetProperties() {
     var targetView = new ProfilingTargetView(_serviceProvider, _target);
     var dialog = new LaunchProfiling(_serviceProvider, targetView);
     var res = dialog.ShowModal() ?? false;
     if (res && targetView.IsValid) {
         var target = targetView.GetTarget();
         if (target != null && !ProfilingTarget.IsSame(target, _target)) {
             _target = target;
             MarkDirty();
             return _target;
         }
     }
     return null;
 }