Пример #1
0
        /// <summary>
        /// Start a memory profiling (heaptrack) session.
        /// </summary>
        public void StartHeaptrack()
        {
            Project project;

            if (!CanStartProfiler(out project) || (project == null))
            {
                return;
            }

            var sessionConfiguration = new HeaptrackSessionConfiguration(project, HeaptrackOptions);

            SDBDeviceInfo device = GetAndCheckSelectedDevice(RunMode.MemoryProfiler);

            if (device == null)
            {
                return;
            }

            HeaptrackSession session = HeaptrackLauncher.CreateSession(device, sessionConfiguration);

            if (session == null)
            {
                return;
            }
            HeaptrackLauncher.StartSession(session);
        }
Пример #2
0
        private ProfilerPlugin(Package package, IVsOutputWindowPane outputPaneTizen, IVsThreadedWaitDialogFactory dialogFactory)
        {
            _package         = package ?? throw new ArgumentNullException(nameof(package));
            _outputPaneTizen = outputPaneTizen;
            _dialogFactory   = dialogFactory;

            OLEServiceProvider =
                GetService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider)) as
                Microsoft.VisualStudio.OLE.Interop.IServiceProvider;

            VsUiShell5 = GetIVsUIShell5();

            ExplorerWindowCommand.Initialize(_package);
            ProfilingProgressWindowCommand.Initialize(_package);

            GeneralOptions   = new GeneralOptions(new SettingsStore(_package, SettingsCollectionPath));
            HeaptrackOptions = new HeaptrackOptions(new SettingsStore(_package, SettingsCollectionPath));

            RegisterMenuHandlers();

            ProfileLauncher.Initialize();
            HeaptrackLauncher.Initialize();

            ProfileLauncher   = ProfileLauncher.Instance;
            HeaptrackLauncher = HeaptrackLauncher.Instance;
            HeaptrackLauncher.OnSessionFinished += HandleMenuItemRunMemoryProfiler;

            _solutionListener = new SolutionListener(_package)
            {
                AfterOpenSolution = delegate
                {
                    _solutionSessionsContainer.Update();
                    return(VSConstants.S_OK);
                },
                AfterCloseSolution = delegate
                {
                    _solutionSessionsContainer.Update();
                    return(VSConstants.S_OK);
                }
            };
            _solutionListener.Initialize();

            _solutionSessionsContainer = new SolutionSessionsContainer((DTE2)Package.GetGlobalService(typeof(SDTE)));
        }