示例#1
0
 public void SetProfilerSetup(ProfilerSettings setup)
 {
     Configuration.ProfilerSetup.Item          = setup.ToString();
     Configuration.ProfilerSetup.Exists        = true;
     Configuration.ProfilerSetup.IsLocal       = _isLocal;
     Configuration.ProfilerSetup.ShouldExclude = false;
     Configuration.ProfilerSetup.ShouldMerge   = false;
 }
示例#2
0
        public void ProfilerSettings_Runner_SetIterartions()
        {
            var settings = new ProfilerSettings();

            // this sets a new iterationrunner
            settings.Iterations = 1;

            settings.Runner.Should().BeOfType <IterationRunner>();
        }
 public ServiceControlConnectionViewModel(
     ISettingsProvider settingsProvider,
     IContainer container)
 {
     this.settingsProvider = settingsProvider;
     this.container = container;
     appSettings = settingsProvider.GetSettings<ProfilerSettings>();
     DisplayName = "Connect To ServiceControl";
 }
 public ServiceControlConnectionViewModel(
     ISettingsProvider settingsProvider,
     IContainer container)
 {
     _settingsProvider = settingsProvider;
     _container        = container;
     _appSettings      = settingsProvider.GetSettings <ProfilerSettings>();
     DisplayName       = "Connect To ServiceControl";
 }
示例#5
0
        public void ProfilerSettings_Runner_SetDuration()
        {
            var settings = new ProfilerSettings();

            // this sets a new iterationrunner
            settings.Duration = TimeSpan.FromSeconds(1);

            settings.Runner.Should().BeOfType <DurationRunner>();
        }
 public DefaultServiceControl(
     IServiceControlConnectionProvider connection,
     IEventAggregator eventAggregator,
     ISettingsProvider settingsProvider)
 {
     _connection      = connection;
     _eventAggregator = eventAggregator;
     _settings        = settingsProvider.GetSettings <ProfilerSettings>();
 }
示例#7
0
        /// <summary>
        /// Executes the task
        /// </summary>
        /// <param name="task">The task to run</param>
        /// <param name="settings">The settings for the profiler</param>
        /// <returns>The resulting collection of the executions</returns>
        public virtual IProfilerResult Execute(ITask task, ProfilerSettings settings)
        {
            if (_next == null)
            {
                return(new ProfilerResult());
            }

            return(_next.Execute(task, settings));
        }
示例#8
0
        ProfilerSettings GetReloadedSettings()
        {
            var settings = new ProfilerSettings();

            settings.RecentServiceControlEntries.Add("http://localhost/api");
            settings.RecentServiceControlEntries.Add("http://othermachine:8888/api");

            return(settings);
        }
示例#9
0
 public WidgetZoneFilter(
     ICommonServices services,
     Lazy <IWidgetProvider> widgetProvider,
     ProfilerSettings profilerSettings)
 {
     this._services         = services;
     this._widgetProvider   = widgetProvider;
     this._profilerSettings = profilerSettings;
 }
        ProfilerSettings GetReloadedSettings()
        {
            var settings = new ProfilerSettings();

            settings.RecentServiceControlEntries.Add("http://localhost/api");
            settings.RecentServiceControlEntries.Add("http://othermachine:8888/api");

            return settings;
        }
        public WidgetZoneFilter(
			ICommonServices services, 
			Lazy<IWidgetProvider> widgetProvider, 
			ProfilerSettings profilerSettings)
		{
			this._services = services;
			this._widgetProvider = widgetProvider;
			this._profilerSettings = profilerSettings;
		}
 public MachineNameFilter(
     ICommonServices services,
     Lazy <IWidgetProvider> widgetProvider,
     ProfilerSettings profilerSettings)
 {
     _services         = services;
     _widgetProvider   = widgetProvider;
     _profilerSettings = profilerSettings;
 }
        private ProfilerSettings GetReloadedSettings()
        {
            var settings = new ProfilerSettings();

            settings.RecentManagementApiEntries.Add("http://localhost/api");
            settings.RecentManagementApiEntries.Add("http://othermachine:8888/api");

            return(settings);
        }
示例#14
0
        public void ProfilerSettings_Runner_SetDuration_CheckNew()
        {
            var settings = new ProfilerSettings();
            var runner   = settings.Runner;

            // this sets a new iterationrunner
            settings.Duration = TimeSpan.FromSeconds(1);

            settings.Runner.Should().NotBeSameAs(runner);
        }
示例#15
0
        public void ProfilerSettings_Runner_SetIterartions_CheckNew()
        {
            var settings = new ProfilerSettings();
            var runner   = settings.Runner;

            // this sets a new iterationrunner
            settings.Iterations = 1;

            settings.Runner.Should().NotBeSameAs(runner);
        }
示例#16
0
 public ProfilerFilter(
     ICommonServices services,
     Lazy <IWidgetProvider> widgetProvider,
     ProfilerSettings profilerSettings,
     IMobileDeviceHelper mobileDeviceHelper)
 {
     this._services           = services;
     this._widgetProvider     = widgetProvider;
     this._profilerSettings   = profilerSettings;
     this._mobileDeviceHelper = mobileDeviceHelper;
 }
 public void TestInitialize()
 {
     shell = Substitute.For<ShellViewModel>();
     serviceControl = Substitute.For<IServiceControl>();
     settingsProvider = Substitute.For<ISettingsProvider>();
     connection = Substitute.For<ServiceControlConnectionProvider>();
     container = RegisterContainer();
     storedSetting = GetReloadedSettings();
     settingsProvider.GetSettings<ProfilerSettings>().Returns(storedSetting);
     connectTo = new ServiceControlConnectionViewModel(settingsProvider, container) { Parent = shell }; //TODO: Do we need to pass the full container here?
 }
示例#18
0
 public WidgetZoneFilter(
     ICommonServices services,
     Lazy <IWidgetProvider> widgetProvider,
     ProfilerSettings profilerSettings,
     IDisplayControl displayControl)
 {
     _services         = services;
     _widgetProvider   = widgetProvider;
     _profilerSettings = profilerSettings;
     _displayControl   = displayControl;
 }
示例#19
0
        public ActionResult Configure(ConfigurationModel model, ProfilerSettings settings)
        {
            if (!ModelState.IsValid)
            {
                return(Configure(settings));
            }

            ModelState.Clear();
            MiniMapper.Map(model, settings);

            return(RedirectToConfiguration("SmartStore.DevTools"));
        }
示例#20
0
        /// <summary>
        /// Runs the task for the given amount of iterations that are defined in the <see cref="ProfilerSettings"/>
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="context"></param>
        /// <param name="action"></param>
        public void Run(ProfilerSettings settings, ExecutionContext context, Action action)
        {
            _logger.Write($"Running Task for {settings.Iterations} iterations for Perfomance Analysis Benchmark");

            var execution = settings.Execution;

            for (var i = 0; i < settings.Iterations; i++)
            {
                _logger.Write($"Running Task for iteration {i}");
                context.Set(ContextKeys.Iteration, i + 1);
                execution.Execute(action);
            }
        }
        public void WarmupSessionHandler_Execute_EnsureTaskIsRun()
        {
            var settings = new ProfilerSettings {
                Iterations = 10
            };

            var task    = new Mock <ITask>();
            var handler = new WarmupSessionHandler();

            var result = handler.Execute(task.Object, settings);

            task.Verify(exp => exp.Run(It.IsAny <IExecutionContext>()), Times.Once);
        }
 public DefaultServiceControl(
     ServiceControlConnectionProvider connection,
     IEventAggregator eventAggregator,
     ISettingsProvider settingsProvider)
 {
     this.connection      = connection;
     this.eventAggregator = eventAggregator;
     settings             = settingsProvider.GetSettings <ProfilerSettings>();
     cache = new MemoryCache("ServiceControlReponses", new NameValueCollection(1)
     {
         { "cacheMemoryLimitMegabytes", settings.CacheSize.ToString() }
     });
 }
示例#23
0
 public void TestInitialize()
 {
     shell            = Substitute.For <ShellViewModel>();
     serviceControl   = Substitute.For <IServiceControl>();
     settingsProvider = Substitute.For <ISettingsProvider>();
     connection       = Substitute.For <ServiceControlConnectionProvider>();
     container        = RegisterContainer();
     storedSetting    = GetReloadedSettings();
     settingsProvider.GetSettings <ProfilerSettings>().Returns(storedSetting);
     connectTo = new ServiceControlConnectionViewModel(settingsProvider, container)
     {
         Parent = shell
     };                                                                                                 //TODO: Do we need to pass the full container here?
 }
示例#24
0
        public ActionResult Configure(ProfilerSettings model, FormCollection form)
        {
            if (!ModelState.IsValid)
                return Configure();

            ModelState.Clear();

            // load settings for a chosen store scope
            var storeDependingSettingHelper = new StoreDependingSettingHelper(ViewData);
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);

            storeDependingSettingHelper.UpdateSettings(model /*settings*/, form, storeScope, _settingService);
            _settingService.ClearCache();

            return Configure();
        }
示例#25
0
        public ActionResult Configure(ProfilerSettings model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            // load settings for a chosen store scope
            var storeDependingSettingHelper = new SiteDependingSettingHelper(ViewData);
            var storeScope = this.GetActiveSiteScopeConfiguration(_storeService, _workContext);

            storeDependingSettingHelper.UpdateSettings(model /*settings*/, form, storeScope, _settingService);
            _settingService.ClearCache();

            return(Configure());
        }
        public void WarmupSessionHandler_Execute_EnsureBaseIsCalled()
        {
            var next = new Mock <ISessionHandler>();

            next.Setup(exp => exp.Execute(It.IsAny <ITask>(), It.IsAny <ProfilerSettings>())).Returns(() => new ProfilerResult());

            var settings = new ProfilerSettings {
                Iterations = 10
            };

            var task    = new Task(() => Thread.Sleep(TimeSpan.FromSeconds(0.5)));
            var handler = new WarmupSessionHandler();

            handler.SetNext(next.Object);

            var result = handler.Execute(task, settings);

            next.Verify(exp => exp.Execute(task, settings), Times.Once);
        }
示例#27
0
        /// <summary>
        /// Runs the task for the given duration that is defined in the <see cref="ProfilerSettings"/>
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="context"></param>
        /// <param name="action"></param>
        public void Run(ProfilerSettings settings, ExecutionContext context, Action action)
        {
            _logger.Write($"Running Task for {settings.Duration} for Perfomance Analysis Benchmark");
            var time = DateTime.Now + settings.Duration;

            var execution = settings.Execution;

            var iteration = 1;

            while (DateTime.Now < time)
            {
                _logger.Write($"Running Task for iteration {iteration}");
                context.Set(ContextKeys.Iteration, iteration);

                execution.Execute(action);

                iteration++;
            }
        }
        public ActionResult ConfigurePost(ProfilerSettings settings)
        {
			return RedirectToConfiguration("SmartStore.DevTools");
        }
示例#29
0
        public ActionResult Configure(ProfilerSettings settings)
        {
            var model = MiniMapper.Map <ProfilerSettings, ConfigurationModel>(settings);

            return(View(model));
        }
 public void SetProfilerSetup(ProfilerSettings setup)
 {
     Configuration.ProfilerSetup.Item = setup.ToString();
     Configuration.ProfilerSetup.Exists = true;
     Configuration.ProfilerSetup.IsLocal = _isLocal;
     Configuration.ProfilerSetup.ShouldExclude = false;
     Configuration.ProfilerSetup.ShouldMerge = false;
 }
示例#31
0
        public void ProfilerSettings_Runner_Default()
        {
            var settings = new ProfilerSettings();

            settings.Runner.Should().BeOfType <IterationRunner>();
        }
示例#32
0
 public override IProfilerResult Execute(ITask task, ProfilerSettings settings)
 {
     Calls = Calls + 1;
     return(base.Execute(task, settings));
 }
 public ActionResult Configure(ProfilerSettings settings)
 {
     return View(settings);
 }