public void StartProfiling(int profiledProcessId, Guid agentApplicationUid)
        {
            //Profiling is already started or decoding in progress
            if (_profiledProcess != null)
            {
                return;
            }
            DirectoryInfo profilingResultsDirectory = _application.ApplicationSettings.ProfilingResults.GetDirectory();
            string        profilingResultsFile      = Path.Combine(profilingResultsDirectory.FullName, _application.Uid.ToString("N"));

            _storage                 = new DataStorage(profilingResultsFile);
            _profiledProcess         = new ProfiledProcessManager(profiledProcessId);
            _profiledProcess.Exited += OnProfiledProcessExited;
            ProcessInformation       = _profiledProcess.GetProcessInformation();
            IStreamFactory streamFactory = Connector.Native.StreamFactory;

            _requestServer = new RequestServer();
            _requestServer.Run(streamFactory.CreateInvokeStream());
            _gatewayServer = new NativeGatewayServer(_agentLibrary, Connector.ApplicationUid, _application.ConfigurationSettings.GatewaySettings); //new ManagedGatewayServer(streamFactory, _application.Settings.GatewaySettings);//
            _agentClient   = new RequestClient(streamFactory.OpenInvokeStream(agentApplicationUid));
            ConfigurationSettings           configurationSettings  = _application.ConfigurationSettings;
            ProfilingTypeSettingsCollection profilingTypesSettings = configurationSettings.ProfilingTypesSettings;

            _profilingTypesManager = new ProfilingTypeManager(_profilingTypes, profilingTypesSettings);
            _profilingTypesManager.AttachStorage(_storage);
            _profilingTypesManager.ExportServices(_application.ServiceContainer);
            _profilingTypesManager.ImportServices(_application.ServiceContainer);
            _profilingTypesManager.StartProfiling(_gatewayServer);
            _gatewayServer.Lock();
            _gatewayServer.Start();
            _application.RaiseSessionStateChanged();
        }
        private void RunProfilingTypes()
        {
            ProfilingTypeSettingsCollection profilingTypesSettings = _configurationSettings.ProfilingTypesSettings;
            List <IProfilingTypeAdapter>    adapters = new List <IProfilingTypeAdapter>();

            foreach (ProfilingTypeSettings profilingTypeSettings in profilingTypesSettings)
            {
                IProfilingType        profilingType = ProfilingTypes[profilingTypeSettings.Uid];
                IProfilingTypeAdapter adapter       = profilingType.GetWinAdapter();
                adapters.Add(adapter);
            }
            foreach (IProfilingTypeAdapter adapter in adapters)
            {
                IServiceConsumer serviceConsumer = adapter as IServiceConsumer;
                if (serviceConsumer != null)
                {
                    serviceConsumer.ExportServices(_session.ServiceContainer);
                }
            }
            foreach (IProfilingTypeAdapter adapter in adapters)
            {
                IServiceConsumer serviceConsumer = adapter as IServiceConsumer;
                if (serviceConsumer != null)
                {
                    serviceConsumer.ImportServices(_session.ServiceContainer);
                }
            }
        }
Beispiel #3
0
 public ProfilingTypeViewModel(IProfilingType profilingType, FrameworkViewModel framework,
                               List <ProfilingTypeViewModel> profilingTypes, ProfilingTypeSettingsCollection profilingTypesSettings)
 {
     _references             = 0;
     _profilingType          = profilingType;
     _framework              = framework;
     _profilingTypes         = profilingTypes;
     _profilingTypesSettings = profilingTypesSettings;
 }
 private void Initialize(ProfilingTypeSettingsCollection profilingTypesSettings)
 {
     foreach (IProfilingType profilingType in _profilingTypes)
     {
         ProfilingTypeSettings settings = profilingTypesSettings[profilingType.Definition.Uid];
         if (settings != null)
         {
             ProfilingTypeFacade facade = new ProfilingTypeFacade(profilingType, settings);
             _adapters.Add(facade);
         }
     }
     SortAdapters();
 }
 public ProfilingTypeManager(IProfilingTypeCollection profilingTypes, ProfilingTypeSettingsCollection profilingTypesSettings)
 {
     _profilingTypes = profilingTypes;
     _adapters       = new List <ProfilingTypeFacade>();
     Initialize(profilingTypesSettings);
 }