Example #1
0
        public SessionSettings Handle(Guid configurationUid, int processId, ProcessPlatform processPlatform, uint profilingBeginTime, Guid agentApplicationUid)
        {
            Configuration configuration = (Configuration)_configurations[configurationUid];

            if (configuration == null)
            {
                throw new ConfigurationNotFoundException(configurationUid);
            }
            ConfigurationSettings   configurationSettings  = configuration.ConfigurationSettings;
            IProfilingTarget        profilingTarget        = _profilingTargets[configurationSettings.ProfilingTargetSettings.Uid];
            IProfilingTargetAdapter profilingTargetAdapter = profilingTarget.GetSafeAdapter();
            bool canStartProfiling = profilingTargetAdapter.CanStartProfiling(configurationSettings, processId);

            if (!canStartProfiling)
            {
                throw new TempException("Target process is not supported");
            }
            ActualizeConfigurationSettings(configurationSettings, processPlatform);
            Session session = (Session)_sessions.Create(configuration);

            session.StartProfiling(processId, agentApplicationUid, profilingBeginTime);
            SessionSettings sessionSettings = new SessionSettings(session.Uid, configurationSettings.ProfilingTargetSettings,
                                                                  configurationSettings.FrameworksSettings, configurationSettings.ProfilingTypesSettings, configurationSettings.GatewaySettings);

            sessionSettings.Validate();
            profilingTarget.GetSafeAdapter().ProfilingStarted(configurationSettings, sessionSettings, processId);
            return(sessionSettings);
        }
Example #2
0
        private void Initialize()
        {
            ExportDefinition exportDefinition = Definition.Exports.FindByApplication(Constants.ApplicationCodeName.Core);

            if (exportDefinition.LoadBehavior == LoadBehavior.OnStartup)
            {
                _adapter = _exportLoader.Load <IProfilingTargetAdapter>(exportDefinition);
            }
        }
Example #3
0
        public override ViewModel CreateViewModel()
        {
            ViewModel viewModel             = null;
            IProfilingTargetAdapter adapter = _profilingTarget.GetWinAdapter();

            if (adapter != null)
            {
                viewModel = adapter.CreateConfigurationViewModel(_pageViewModel);
            }
            return(viewModel);
        }
        public void Activate()
        {
            VerifyDisposed();
            IProfilingTargetAdapter    adapter    = _profilingTarget.GetSafeAdapter();
            IProfilingTargetController controller = adapter.CreateController(_configurationSettings);

            //Select all Frameworks that involved into profiling and notify them
            foreach (FrameworkSettings frameworkSettings in _configurationSettings.FrameworksSettings)
            {
                IFramework        framework        = _frameworks[frameworkSettings.Uid];
                IFrameworkAdapter frameworkAdapter = framework.GetSafeAdapter();
                frameworkAdapter.ConfigureForProfiling(_configurationSettings);
            }
            //Start profiling
            controller.Start();
            controller.TargetStopped += OnControllerTargetStopped;
            lock (_controllers)
            {
                _controllers.Add(controller);
            }
        }