Beispiel #1
0
        /// <summary>
        /// Executes the compiler post compiler stages.
        /// </summary>
        /// <remarks>
        /// The method iterates the compilation stage chain and runs each
        /// stage on the input.
        /// </remarks>
        internal void Finalization()
        {
            PostEvent(CompilerEvent.FinalizationStart);

            foreach (BaseCompilerStage stage in CompilerPipeline)
            {
                PostEvent(CompilerEvent.FinalizationStageStart, stage.Name);

                // Execute stage
                stage.ExecuteFinalization();

                PostEvent(CompilerEvent.FinalizationStageEnd, stage.Name);
            }

            MethodScanner.Complete();

            // Sum up the counters
            foreach (var methodData in CompilerData.MethodData)
            {
                GlobalCounters.Merge(methodData.Counters);
            }

            EmitCounters();

            PostEvent(CompilerEvent.FinalizationEnd);
            PostEvent(CompilerEvent.CompileEnd);
        }
Beispiel #2
0
 private void ExportCounters()
 {
     foreach (var counter in GlobalCounters.Export())
     {
         NewCompilerTraceEvent(CompilerEvent.Counter, counter);
     }
 }
Beispiel #3
0
 private void EmitCounters()
 {
     foreach (var counter in GlobalCounters.Export())
     {
         PostEvent(CompilerEvent.Counter, counter);
     }
 }
Beispiel #4
0
        public void AddGlobalCounter()
        {
            var ret = new CounterItemModel(GlobalCounters);

            GlobalCounters.Add(ret);
            Selection = ret;
            RaisePropertyChanged("GlobalCounters");
        }
Beispiel #5
0
        protected override void OnViewLoaded(object view)
        {
            this.OpenBanner();
            GlobalCounters.ResetAll();
            DeletePdfFiles();
            ((DynamicEnShellView)view).CloseDisclaimer.Click += CloseDisclaimer_Click;

            base.OnViewLoaded(view);
        }
        public void AddGlobalCounter()
        {
            var ret = new CounterItemViewModel()
            {
                ItemSource = GlobalCounters
            };

            GlobalCounters.Add(ret);
            Selection = ret;
            RaisePropertyChanged("GlobalCounters");
        }
Beispiel #7
0
        protected override void OnViewLoaded(object view)
        {
            _buyWifiBrowser = new ChromiumWebBrowser()
            {
                Address = this.buyWifiEnApi,
            };

            _buyWifiBrowser.BrowserSettings = new CefSharp.BrowserSettings()
            {
                OffScreenTransparentBackground = false,
            };

            _buyWifiBrowser.Load(this.buyWifiEnApi);



            _buyWifiBrowser.LifeSpanHandler = new LifeSpanHandler();
            _buyWifiBrowser.RequestHandler  = new CustomRequestHandler("", log, sender, this.numberOfAvailablePagesToPrint, events);
            _buyWifiBrowser.DialogHandler   = new CustomDialogHandler();
            _buyWifiBrowser.MenuHandler     = new CustomMenuHandler();

            ((BuyWifiView)view).BuyWifiBrowser.Children.Add(_buyWifiBrowser);

            _buyWifiBrowser.TouchDown += _buyWifiBrowser_TouchDown;

            _buyWifiBrowser.TouchMove += _buyWifiBrowser_TouchMove;

            _buyWifiBrowser.MouseDown += _buyWifiBrowser_MouseDown;

            _buyWifiBrowser.PreviewMouseUp += _buyWifiBrowser_PreviewMouseUp;

            _buyWifiBrowser.RequestContext = new RequestContext();

            _buyWifiBrowser.Focus();

            var obj = new CustomBoundObject(this.numberOfAvailablePagesToPrint, this.log, sender, events);

            _buyWifiBrowser.RegisterJsObject("bound", obj);
            _buyWifiBrowser.FrameLoadEnd += obj.OnFrameLoadEnd;

            GlobalCounters.ResetAll();


            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 1, 0);
            timer.Tick    += TimerTick;
            timer.Start();

            startTime = DateTime.Now;

            base.OnViewLoaded(view);
        }
        public async Task Start()
        {
            _device = await BluetoothLEDevice.FromBluetoothAddressAsync(_address);

            if (_device == null)
            {
                GlobalCounters.IncrementFailedCreate();
                return;
            }
            GlobalDeviceNameTracking.ReportName(_device.Name, _device.BluetoothAddress);

            _device.ConnectionStatusChanged += ConnectionStatusChanged;

            GlobalCounters.IncrementDevicesCreated();
        }
Beispiel #9
0
        public ITestState Start()
        {
            _threadPoolCounter = new ThreadPoolCounter();

            PipeFactory <IResult> pipeFactory = new PipeFactory <IResult>();

            _aggregator = new PipelineDataAggregator(_settings.Aggregators, pipeFactory);
            _aggregator.Start();

            _globalCounters = GlobalCounters.CreateDefault();

            _errorHandler = new ErrorHandler();

            _limit     = new LimitsHandler(_settings.Limits);
            _threading = _settings.Threading;

            _state = new TestState(_timer, _globalCounters, _threadPoolCounter);

            _speed = PriorityStrategyFactory.Create(_settings.Speeds, _timer);
            _speed.Setup(_state);

            IIterationContextFactory iterationContextFactory = CreateIterationContextFactory();
            IScenarioHandlerFactory  scenarioHandlerFactory  = CreateScenarioHandlerFactory();
            ISchedulerFactory        schedulerFactory        = CreateSchedulerFactory();
            IDataCollectorFactory    dataCollectorFactory    = CreateDataCollectorFactory(pipeFactory, _threadPoolCounter);
            IScenarioThreadFactory   scenarioThreadFactory   = CreateScenarioThreadFactory();

            IThreadFactory threadFactory = new ScenarioThreadFactory(
                iterationContextFactory,
                scenarioHandlerFactory,
                schedulerFactory,
                dataCollectorFactory,
                scenarioThreadFactory
                );

            _pool = new ThreadPool(threadFactory, _threadPoolCounter);

            InitialThreadingSetup();

            _timer.Start(); // This line also releases Worker-Threads from wait in IPrewait

            return(_state);
        }
Beispiel #10
0
        /// <summary>
        /// Executes the compiler post compiler stages.
        /// </summary>
        /// <remarks>
        /// The method iterates the compilation stage chain and runs each
        /// stage on the input.
        /// </remarks>
        internal void PostCompile()
        {
            foreach (BaseCompilerStage stage in CompilerPipeline)
            {
                NewCompilerTraceEvent(CompilerEvent.PostCompileStageStart, stage.Name);

                // Execute stage
                stage.ExecutePostCompile();

                NewCompilerTraceEvent(CompilerEvent.PostCompileStageEnd, stage.Name);
            }

            // Sum up the counters
            foreach (var methodData in CompilerData.MethodData)
            {
                GlobalCounters.Merge(methodData.Counters);
            }

            ExportCounters();
        }
Beispiel #11
0
        public virtual ITestState Start()
        {
            _threadPoolCounter = new ThreadPoolCounter();
            _globalCounters    = GlobalCounters.CreateDefault();
            ITestState            testState   = new TestState(_timer, _globalCounters, _threadPoolCounter);
            PipeFactory <IResult> pipeFactory = new PipeFactory <IResult>();

            _aggregator = new PipelineDataAggregator(_settings.Aggregators, pipeFactory);
            _aggregator.Start();

            _errorHandler = new ErrorHandler();
            _dataReader   = _settings.DataReader;
            _dataReader.Begin(testState);

            IIterationContextFactory      iterationContextFactory = CreateIterationContextFactory();
            IReplayScenarioHandlerFactory scenarioHandlerFactory  = CreateScenarioHandlerFactory();
            IReplaySchedulerFactory       schedulerFactory        = CreateSchedulerFactory();
            IDataCollectorFactory         dataCollectorFactory    = CreateDataCollectorFactory(pipeFactory, _threadPoolCounter);
            IScenarioThreadFactory        scenarioThreadFactory   = CreateScenarioThreadFactory();

            IThreadFactory threadFactory = new ReplayScenarioThreadFactory(
                iterationContextFactory,
                scenarioHandlerFactory,
                schedulerFactory,
                dataCollectorFactory,
                scenarioThreadFactory
                );

            _pool = new ThreadPool(threadFactory, _threadPoolCounter);
            _pool.StartWorkersAsync(_settings.ThreadCount);

            while (_threadPoolCounter.CreatedThreadCount != _threadPoolCounter.InitializedThreadCount)
            {
                Thread.Sleep(100);
                _errorHandler.Assert();
            }

            _timer.Start(); // This line also releases Worker-Threads from wait in IPrewait

            return(testState);
        }
Beispiel #12
0
        // TODO: Redesign validator so it uses actual handlers.

        /// <summary>
        /// Validates ILoadTest scenario correctness by executing single test iteration
        /// from ScenarioSetup to ScenarioTearDown on the same thread.
        /// Exceptions are not handled on purpose to ease problem identification while developing.
        /// </summary>
        /// <param name="scenario">ILoadTestScenario object</param>
        /// <param name="threadId">TheardId to set in TestContext</param>
        /// <param name="threadIterationId">ThreadIterationId to set in TestContext</param>
        /// <param name="globalIterationId">GlobalIterationId to set in TestContext</param>
        /// <returns>Raw result from single iteration</returns>
        public static IterationResult Validate(this IScenario scenario, int threadId = 0, int threadIterationId = 0, int globalIterationId = 0)
        {
            ExecutionTimer    timer          = new ExecutionTimer();
            ThreadSafeCounter errorsCounter  = new ThreadSafeCounter();
            GlobalCounters    globalCounters = new GlobalCounters(errorsCounter, new MockedIdGenerator(globalIterationId));
            IIterationControl context        = new IterationContext(threadId, timer);

            ScenarioHandler handler = new ScenarioHandler(globalCounters, new MockedIdGenerator(threadIterationId), scenario, context);

            timer.Start();

            handler.Init();
            handler.PrepareNext();
            handler.Execute();

            IterationResult result = new IterationResult(context, new WorkerThreadStats());

            handler.Cleanup();

            timer.Stop();

            return(result);
        }
Beispiel #13
0
        public static IterationResult Validate <TData>(this IReplayScenario <TData> scenario, DataItem data, int threadId = 0, int threadIterationId = 0, int globalIterationId = 0)
        {
            ExecutionTimer    timer          = new ExecutionTimer();
            ThreadSafeCounter errorsCounter  = new ThreadSafeCounter();
            GlobalCounters    globalCounters = new GlobalCounters(errorsCounter, new MockedIdGenerator(globalIterationId));
            IIterationControl context        = new IterationContext(threadId, timer);

            ReplayScenarioHandler <TData> handler = new ReplayScenarioHandler <TData>(globalCounters, new MockedIdGenerator(threadIterationId), scenario, context);

            timer.Start();

            handler.Init();
            handler.PrepareNext();
            handler.SetData(data.Value, data.TimeStamp);
            handler.Execute();

            IterationResult result = new IterationResult(context, new WorkerThreadStats());

            handler.Cleanup();

            timer.Stop();

            return(result);
        }
Beispiel #14
0
 /// <summary>
 /// Updates the counter.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="count">The count.</param>
 protected void UpdateCounter(string name, int count)
 {
     GlobalCounters.Update(name, count);
 }
        protected override void OnViewLoaded(object view)
        {
            if (!ShowBannerUrl)
            {
                _internetAccessBrowser = new ChromiumWebBrowser()
                {
                    Address = this.internetAccessEnApi,
                };

                _internetAccessBrowser.Load(this.internetAccessEnApi);

                this.OpenKeyboard = true;
            }
            else
            {
                _internetAccessBrowser = new ChromiumWebBrowser()
                {
                    Address = this.bannerLinkEnApi,
                };

                _internetAccessBrowser.Load(this.bannerLinkEnApi);

                this.OpenKeyboard = false;
            }

            _internetAccessBrowser.BrowserSettings = new CefSharp.BrowserSettings()
            {
                OffScreenTransparentBackground = false,
            };

            _internetAccessBrowser.BrowserSettings.FileAccessFromFileUrls      = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.WebSecurity = CefState.Enabled;
            _internetAccessBrowser.BrowserSettings.Javascript  = CefState.Enabled;


            _internetAccessBrowser.LifeSpanHandler = new LifeSpanHandler();


            _internetAccessBrowser.RequestHandler = new CustomRequestHandler("", log, sender, this.numberOfAvailablePagesToPrint, events);

            _internetAccessBrowser.MenuHandler = new CustomMenuHandler();


            _internetAccessBrowser.DialogHandler = new CustomDialogHandler();



            ((InternetAccess2View)view).InternetAccessBrowser.Children.Add(_internetAccessBrowser);

            _internetAccessBrowser.TouchDown += _internetAccessBrowser_TouchDown;

            _internetAccessBrowser.TouchMove += _internetAccessBrowser_TouchMove;

            _internetAccessBrowser.MouseDown += _internetAccessBrowser_MouseDown;

            _internetAccessBrowser.PreviewMouseUp += _internetAccessBrowser_PreviewMouseUp;

            _internetAccessBrowser.RequestContext = new RequestContext();



            _internetAccessBrowser.Focus();


            var boundObject = new CustomBoundObject(this.numberOfAvailablePagesToPrint, this.log, sender, events);

            _internetAccessBrowser.RegisterJsObject("bound", boundObject);
            _internetAccessBrowser.FrameLoadEnd += boundObject.OnFrameLoadEnd;

            GlobalCounters.ResetAll();


            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 1, 0);
            timer.Tick    += TimerTick;
            timer.Start();

            startTime = DateTime.Now;

            base.OnViewLoaded(view);
        }