public void Run(StopWatch stopWatch)
		{
			stopWatch.Start();

			CheckPoint point = stopWatch.Mark("Correlated Requests");
		    CheckPoint responsePoint = stopWatch.Mark("Correlated Responses");

		    var pool = new ManagedThreadPool<CorrelatedController>(DoWorker, 10, 10);
            try
            {

                for (int index = 0; index < _attempts; index++)
                {
                    var controller = new CorrelatedController(_bus, OnSuccess, OnTimeout);
                    pool.Enqueue(controller);
                }

                point.Complete(_attempts);

                _finishedEvent.WaitOne(TimeSpan.FromSeconds(60), true);

                responsePoint.Complete(_timeouts + _successes);
            }
            finally
            {
                pool.Dispose();
            }

			Console.WriteLine("Attempts: {0}, Succeeded: {1}, Timeouts: {2}", _attempts, _successes, _timeouts);

			stopWatch.Stop();
		}
Beispiel #2
0
        public SleepWatch(uint interval)
        {
            mInterval = interval;

            mWatch = StopWatch.Create(StopWatch.TickStyles.Milliseconds);
            mWatch.Start();
        }
    // Use this for initialization
    void Start()
    {
        worldWidth = worldHeight * Camera.main.aspect;

        #region Position walls
        GameObject leftWall = GameObject.Find("Left");
        leftWall.transform.position = new Vector2(-worldWidth - leftWall.transform.localScale.x / 2, 0f);
        leftWall.transform.localScale = new Vector2(1f, worldHeight * 2);

        GameObject rightWall = GameObject.Find("Right");
        rightWall.transform.position = new Vector2(worldWidth + rightWall.transform.localScale.x / 2, 0f);
        rightWall.transform.localScale = new Vector2(1f, worldHeight * 2);

        GameObject topWall = GameObject.Find("Top");
        topWall.transform.position = new Vector2(0f, worldHeight + topWall.transform.localScale.y / 2);
        topWall.transform.localScale = new Vector2(worldWidth * 2, 1f);

        GameObject bottomWall = GameObject.Find("Bottom");
        bottomWall.transform.position = new Vector2(0f, -worldHeight - bottomWall.transform.localScale.y / 2);
        bottomWall.transform.localScale = new Vector2(worldWidth * 2, 1f);
        #endregion

        monsters = new ArrayList();
        humans = new ArrayList();
        monsterSpawnTimer = new StopWatch();
        humanSpawnTimer = new StopWatch();

        spawnMonster();
        spawnHuman();

        monsterSpawnTimer.start();
        humanSpawnTimer.start();
    }
Beispiel #4
0
		public void Run(StopWatch stopWatch)
		{
			_bus.Subscribe<GeneralMessage>(Handle);
			_bus.Subscribe<SimpleResponse>(Handler);

			stopWatch.Start();

			CheckPoint publishCheckpoint = stopWatch.Mark("Publishing " + _repeatCount + " messages");
			CheckPoint receiveCheckpoint = stopWatch.Mark("Receiving " + _repeatCount + " messages");

			for (int index = 0; index < _repeatCount; index++)
			{
				_bus.Publish(new GeneralMessage());
			}

			publishCheckpoint.Complete(_repeatCount);

			bool completed = _completeEvent.WaitOne(TimeSpan.FromSeconds(60), true);

			bool responseCompleted = _responseEvent.WaitOne(TimeSpan.FromSeconds(60), true);

			receiveCheckpoint.Complete(_counter + _responseCounter);

			stopWatch.Stop();
		}
        public void ComparePerformance()
        {
            const int runs = 30000000;
            StopWatch watch = new StopWatch();

            Hashtable ht = CollectionsUtil.CreateCaseInsensitiveHashtable();
            for (int i = 0; i < 1000000; i++) ht.Add(Guid.NewGuid().ToString(), "val"); // gen. higher number of elements results in OOM exception????
            CaseInsensitiveHashtable ciht = new CaseInsensitiveHashtable(ht, CultureInfo.InvariantCulture);

            using (watch.Start("Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    object v = ht["somekey"];
                }
            }

            using (watch.Start("Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    object v = ciht["somekey"];
                }
            }
        }
        public void Run(StopWatch stopWatch)
        {
            stopWatch.Start();

            Console.WriteLine("Starting long term memory test. Press any key to exit.");

            while (true)
            {
                for (int index = 0; index < 1000; index++)
                {
                    _bus.PublishRequest(new SimpleRequest(new Dictionary<string, string> {{"Name", "Value"}}), x =>
                        {
                            Interlocked.Increment(ref _requestCounter);

                            x.Handle<SimpleResponse>(message => { Interlocked.Increment(ref _responseCounter); });
                        });
                }

                DisplayMemoryUsage();

                if (Console.KeyAvailable)
                {
                    break;
                }
            }

            Console.WriteLine("Exiting...");
        }
        public void ExecutesDelegatePerformance()
        {
            Dictionary<string, object> vars = new Dictionary<string, object>(5);
            WaitCallback noop = delegate (object arg)
                                      {
                                          // noop
                                      };
            vars["noop"] = noop;

            FunctionNode fn = new FunctionNode();
            fn.Text = "noop";
            StringLiteralNode str = new StringLiteralNode();
            str.Text = "theArg";
            fn.addChild(str);

            int ITERATIONS = 10000000;

            StopWatch watch = new StopWatch();
            using (watch.Start("Duration Direct: {0}"))
            {
                for (int i = 0; i < ITERATIONS; i++)
                {
                    ((WaitCallback)vars["noop"])(str.getText());
                }
            }

            using (watch.Start("Duration SpEL: {0}"))
            {
                for (int i = 0; i < ITERATIONS; i++)
                {
                    fn.GetValue(null, vars);
                }
            }
        }
    // Use this for initialization
    void Start()
    {
        scoreText.text = "Score: 0";
        timeText.text = "Time: 0";
        stopWatch = new StopWatch ();//Default State is Zero.
        stopWatch.changeState ();//State: Zero to Play.

        //initialize of gotItemNumberList.
        this.gotItemNumberList = new Hashtable ();
        this.gotItemNumberList.Add ("yakisoba", 0);
        this.gotItemListString = "";
        this.gotItemListLabelString = "取得したアイテム\n\n";
        this.gotItemListString = this.gotItemListLabelString;
    }
Beispiel #9
0
 static StopWatch()
 {
     QueryPerformanceFrequency(out _frequency);
     StopWatch callibration = new StopWatch();
     long totalOverhead = 0;
     int loopCount = 0;
     for (int i = 0; i < 1000000; ++i)
     {
         callibration.Start();
         callibration.Stop();
         totalOverhead += callibration.Ticks;
         loopCount++;
     }
     _overhead = totalOverhead / loopCount;
     //Console.WriteLine("Callibrating StopWatch: overhead {0}", _overhead);
 }
        public void RunTestWithoutDI()
        {
            DataView dv = CreateDataSource();

            int runs = 1000;

            StopWatch watch = new StopWatch();
            using (watch.Start("Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    DataGrid grid = new DataGrid();
                    grid.DataSource = dv;
                    grid.DataBind();
                }
            }
        }
        public override void LogSalesOrder(string orderId)
        {
            StopWatch stopWatch = new StopWatch(true);
            string result = "AutoSalesLog: ";
            ProgressText = result + "Exporting single sale...";
            XElement xmlResult = null;

            try
            {
                //access Magento store API
            }
            catch (Exception ex)
            {
                string errMsg = ex.Message;
                if (xmlResult != null)
                {
                    errMsg += "\nMagento Result: ";
                    if (xmlResult.Name.LocalName.Equals("Error"))
                    {
                        if (xmlResult.Element("Id") != null)
                        {
                            errMsg += "Id = " + xmlResult.Element("Id");
                            if (xmlResult.Element("Description") != null)
                                errMsg += " Description = " + xmlResult.Element("Description");
                        }
                        else if (xmlResult.Value != null)
                            errMsg += xmlResult.Value;
                    }
                    else if (xmlResult.Value != null)
                        errMsg += xmlResult.Value;
                }
                if (ex.InnerException != null)
                    errMsg += "\nInner Exception: " + ex.InnerException.Message;

                result = ProgressText + "\n" + errMsg;
            }
            finally
            {
                stopWatch.Stop();
                result += "\nTotal Time: " + stopWatch.TotalTime;
                ProgressText = result;
                //m_log.WriteEntry(result, System.Diagnostics.EventLogEntryType.Information, m_alias);
            }
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            //calling the ReverseString from the StringReverser class
            var reversedString = StringReverser.ReverseString("Pelumi");

            Console.WriteLine(reversedString);

            //calling the ReverseArryOfIntegers from the ArrayReverser class
            var reversedArray = ArrayReverser.ReverseArryOfIntegers(new int[] { 1, 2, 3, 4, 5, 5 });

            Console.WriteLine(reversedArray);

            Console.ReadLine();

            Console.WriteLine(ArrayReverser.ReverseNumber(123));
            Console.ReadLine();

            var stopWatch = new StopWatch();
        }
Beispiel #13
0
        protected virtual T ExecuteScalar <T>(DbCommand dbCommand)
        {
            object result = null;

            StopWatch stopWatch = new StopWatch();

            try
            {
                dbCommand.CommandTimeout = timeout;
                Logger.Info("ExecuteScalar, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}");
                result = database.ExecuteScalar(dbCommand);
                return(ConversionUtil.To <T>(result));
            }
            finally
            {
                stopWatch.End();
                Logger.Info("ExecuteScalar Complete, result=" + ConversionUtil.To <string>(result) + " elapsed=" + stopWatch.ElapsedMs());
            }
        }
Beispiel #14
0
        protected virtual DataSet ExecuteDataSet(DbCommand dbCommand)
        {
            DataSet dataSet = null;

            StopWatch stopWatch = new StopWatch();

            try
            {
                dbCommand.CommandTimeout = timeout;
                dataSet = database.ExecuteDataSet(dbCommand);
                Logger.Info("ExecuteDataSet, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}, Dataset Summary=" + GetDataSetSummary(dataSet));
                return(dataSet);
            }
            finally
            {
                stopWatch.End();
                Logger.Info("ExecuteNonQuery Complete, elapsed=" + stopWatch.ElapsedMs());
            }
        }
Beispiel #15
0
        protected virtual int ExecuteNonQuery(DbCommand dbCommand)
        {
            int result = 0;

            StopWatch stopWatch = new StopWatch();

            try
            {
                dbCommand.CommandTimeout = timeout;
                Logger.Info("ExecuteNonQuery, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}");
                result = database.ExecuteNonQuery(dbCommand);
                return(result);
            }
            finally
            {
                stopWatch.End();
                Logger.Info("ExecuteNonQuery Complete, result=" + result + ", elapsed=" + stopWatch.ElapsedMs());
            }
        }
Beispiel #16
0
        protected virtual int ExecuteBatchSPCall(DbCommand dbCommand, DataSet dataSet)
        {
            int result = 0;

            StopWatch stopWatch = new StopWatch();

            try
            {
                dbCommand.CommandTimeout = timeout;
                Logger.Info("ExecuteBatchUpdate, StoreProcedureName=" + dbCommand.CommandText);
                result = database.UpdateDataSet(dataSet, BATCHTABLENAME, dbCommand, null, null, UpdateBehavior.Standard);
                return(result);
            }
            finally
            {
                stopWatch.End();
                Logger.Info("ExecuteBatchUpdate Complete, result=" + result + " ,elapsed=" + stopWatch.ElapsedMs() + " ms");
            }
        }
        protected override string GetAtt1Names()
        {
            var stopWatch = new StopWatch(true);

            var categories = LoadTabDelimitedFile(_categoriesFilePath).Select(category => new VCategory
                                                                                          {
                                                                                              Id = category["CATEGORY_CODE"],
                                                                                              Name = category["CATEGORY_NAME"]
                                                                                          });
            var sb = new StringBuilder(CommonHeader + Att1Header);
            foreach (var c in categories.Distinct())
            {
            sb.Append(string.Format("{0}\t", c.Id));
            sb.Append(string.Format("{0}\r\n", c.Name));
            }

            stopWatch.Stop();
            return Environment.NewLine + m_boostService.UploadFileTo4Tell(m_alias, "Attribute1Names.txt", sb);
        }
Beispiel #18
0
 public MainViewModel()
 {
     if (IsInDesignMode)
     {
         // Code runs in Blend --> create design time data.
     }
     else
     {
         stopWatch                  = new StopWatch();
         Time                       = displayTime(TimeSpan.Zero);
         StartStopButtonLabel       = "Start";
         this.StartStopTimerCommand = new RelayCommand(this.startStopTimer);
         this.ResetTimerCommand     = new RelayCommand(this.resetTimer);
         //Subscribing to my models' notifications
         stopWatch.PropertyChanged += onStopWatchModelPropertyChanged;
         //Subscribing to navigation messages
         Messenger.Default.Register <NavigationMessage>(this, ProcessNavigationMessage);
     }
 }
        /// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            base.LoadContent(fileName);

            DamageWobbleDefinition def = GameObjectManager.pInstance.pContentManager.Load <DamageWobbleDefinition>(fileName);

            StopWatch watch = StopWatchManager.pInstance.GetNewStopWatch();

            watch.pLifeTime = 4.0f;
            mScaleTween     = new Tween(watch, 0.8f, 1.2f);

            watch           = StopWatchManager.pInstance.GetNewStopWatch();
            watch.pLifeTime = 2.0f;
            mRotationTween  = new Tween(watch, -5, 5);

            mDamageCooldown           = StopWatchManager.pInstance.GetNewStopWatch();
            mDamageCooldown.pLifeTime = def.mFramesToReset;
            mDamageCooldown.ForceExpire();
        }
Beispiel #20
0
        private void saUpdateCustomerNormalized_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            GC.Collect();
            var Result = StopWatch.Start(() =>
            {
                var Os = this.Application.CreateObjectSpace();

                var List = Os.CreateCollection(typeof(Customer), null).Cast <Customer>().ToList();
                foreach (var item in List)
                {
                    item.PhoneNumber = "+503778896";
                    item.Code        = item.Code + "SV";
                }
            }, "Update Customers Normalized Schema");
            var Update = this.ObjectSpace.GetObjectByKey <CrudOperationResult>("Update");

            Update.Normalized = Result.Item2;
            this.ObjectSpace.CommitChanges();
        }
Beispiel #21
0
        private void Solve(uint[,] startMap)
        {
            Console.WriteLine("Start");

            var initBoard = new Board(startMap, null, UseGreedy);

            Size = initBoard.Size;

            GoalBoard = GenerateTarget(Size);

            initBoard.Deviation = Heuristic.Calculate(startMap, GoalBoard, Size);

            var queue = new List <Board> {
                initBoard
            };

            //COUNTERS
            StopWatch.Start();

            while (queue.Count > 0)
            {
                var board = queue[0];
                queue.RemoveAt(0);

                if (board.Deviation == 0)                 //save solution path
                {
                    foreach (var b in board)
                    {
                        Solution.Add(b);
                    }
                    Solution.Reverse();

                    StopWatch.Stop();

                    return;
                }

                MoveZero(board).ForEach(move =>
                {
                    AddWithPriorityCheck(queue, move);
                });
            }
        }
    // Start is called before the first frame update
    IEnumerator Start()
    {
        stopwatch = gameObject.AddComponent <StopWatch>();
        var url        = GetStreamingAssetsUrl(filePath);
        var webRequest = UnityWebRequest.Get(url);

        yield return(webRequest.SendWebRequest());

        if (!string.IsNullOrEmpty(webRequest.error))
        {
            Debug.LogErrorFormat("Error loading {0}: {1}", url, webRequest.error);
            yield break;
        }

        // data = webRequest.downloadHandler.data;
        data = new NativeArray <byte>(webRequest.downloadHandler.data, Allocator.Persistent);

        // LoadBatch();
    }
Beispiel #23
0
        public void FibonacciSequence_Memoized(
            [Values(-1, 0, 1, 2, 3, 4, 8, 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 39, 40, 41, 42)] int numberOfFibonacciArguments)
        {
            FIBONACCI_INVOCATIONS = 0;
            Console.WriteLine("Fibonacci(" + numberOfFibonacciArguments + ") = ");
            StopWatch stopWatch = new StopWatch();

            for (int i = 0; i <= numberOfFibonacciArguments; ++i)
            {
                Console.Write(fibonacci_memoized(i) + " ");
            }
            stopWatch.Stop();
            Console.WriteLine();
            Console.WriteLine("Fibonacci function invoked " + String.Format("{0:0,0}", FIBONACCI_INVOCATIONS) + " times. Took " + stopWatch.DurationInTicks + " ticks | " + stopWatch.DurationInMilliseconds + " ms");
            if (numberOfFibonacciArguments > 30)
            {
                Assert.That(stopWatch.DurationInMilliseconds, Is.LessThan(10));
            }
        }
        public void PerformanceOfMethodEvaluationOnDifferentContextTypes()
        {
            MethodNode mn = new MethodNode();

            mn.Text = "ToString";

            TypeNode nln = new TypeNode();

            nln.Text = "System.Globalization.CultureInfo";

            PropertyOrFieldNode pn = new PropertyOrFieldNode();

            pn.Text = "InvariantCulture";


            Expression exp = new Expression();

            exp.addChild(nln);
            exp.addChild(pn);

            StringLiteralNode sln = new StringLiteralNode();

            sln.Text = "dummy";

            mn.addChild(sln);
            mn.addChild(exp);

            IExpression mnExp = mn;

            Assert.AreEqual("dummy", mnExp.GetValue(0m, null));

            int runs = 10000000;

            StopWatch watch = new StopWatch();

            using (watch.Start("Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    mnExp.GetValue(0m, null);
                }
            }
        }
Beispiel #25
0
        public virtual void Test2()
        {
            var stopWatch = new StopWatch();

            stopWatch.Start();
            IDictionary objects = new Dictionary <object, object>();

            VO.Login.Function f = null;
            OID           oid   = null;
            ObjectWrapper ow    = null;
            var           i     = 0;

            for (i = 0; i < size; i++)
            {
                f   = new VO.Login.Function("function " + i);
                oid = OIDFactory.BuildObjectOID(i);
                objects.Add(oid, new ObjectWrapper(f, false));
                if (i < size / 2)
                {
                    ow = (ObjectWrapper)objects[oid];
                    ow.SetModified(true);
                }
            }
            i = 0;
            var nbModified = 0;
            // Now get all modified objects
            var iterator = objects.Keys.GetEnumerator();

            while (iterator.MoveNext())
            {
                oid = (OID)iterator.Current;
                ow  = (ObjectWrapper)objects[oid];
                if (ow.IsModified())
                {
                    nbModified++;
                }
                i++;
            }
            stopWatch.End();
            Println("time for 1 map =" + stopWatch.GetDurationInMiliseconds());
            AssertEquals(size / 2, nbModified);
        }
Beispiel #26
0
        private void DetectEncodingSyncAction(DetectEncodingFileDto dto)
        {
            string stopWatchKey = "DetectEncodingSyncAction_" + Thread.CurrentThread.ManagedThreadId;

            StopWatch.Start(stopWatchKey);

            //First try BOM detection and Unicode detection using Klerks Soft encoder
            //stream.Seek(0, SeekOrigin.Begin);

            Encoding encoding = EncodingDetector.Detect(dto.SampleBytes, EncodingDetector.Options.MLang);

            //Encoding encoding = null;
            //Encoding[] detected;

            //try
            //{
            //	detected = EncodingTools.DetectInputCodepages(dto.SampleBytes, 1);

            //	if (detected.Length > 0)
            //		encoding = detected[0];
            //}
            //catch (COMException ex)
            //{
            //	// return default codepage on error
            //}



            lock (lockObj)
            {
                _totalFiles++;

                if (encoding != null)
                {
                    _numFoundEncodings++;
                }
            }

            //WriteToConsole(dto.FilePath + ": " + encoding);

            StopWatch.Stop(stopWatchKey);
        }
Beispiel #27
0
        public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
        {
            string        methodName = input.MethodBase.ReflectedType + "." + input.MethodBase.Name;
            StringBuilder param      = new StringBuilder();

            for (int i = 0; i < input.Arguments.Count; i++)
            {
                param.Append(input.Arguments.GetParameterInfo(i).Name + "=" + input.Arguments[i] + ",");
            }
            logger.Debug("Start Invoke, method=" + methodName + ", params=" + param);

            StopWatch stopWatch = new StopWatch();

            IMethodReturn methodReturn = getNext().Invoke(input, getNext);

            stopWatch.Stop();
            logger.Debug("End Invoke, method=" + methodName + ", ElapsedMs=" + stopWatch.ElapsedMs());

            return(methodReturn);
        }
Beispiel #28
0
        /// <exception cref="IOException"></exception>
        private void BenchmarkCommand(string command, int itemCount, string dbFileName, TextWriter
                                      @out)
        {
            HashSet commands = CommandSet(command);

            Db4objects.Db4o.IO.IoAdapter io = IoAdapter(dbFileName);
            LogReplayer replayer            = new LogReplayer(CrudApplication.LogFileName(itemCount), io
                                                              , commands);
            List4     commandList = replayer.ReadCommandList();
            StopWatch watch       = new StopWatch();

            watch.Start();
            replayer.PlayCommandList(commandList);
            watch.Stop();
            io.Close();
            long timeElapsed    = watch.Elapsed();
            long operationCount = ((long)replayer.OperationCounts()[command]);

            PrintStatisticsForCommand(@out, command, timeElapsed, operationCount);
        }
Beispiel #29
0
        private void BeginCrafting(QueuedRecipe queuedRecipe)
        {
            var recipe = queuedRecipe.Recipe;

            // will most likely not make it here in the first place, but jic
            if (recipe.Container.Name != Info.Name)
            {
                throw new UnityException(string.Format("{0} was given a recipe for {1}", Info.Name, recipe.Container.Name));
            }

            // may replace with WorldTime when it is a more flexible type
            var seconds = WorldClock.Instance.GetSeconds(recipe.TimeLength);

            StopWatch.AddNode(STOPWATCH_NAME, seconds, true).OnTick = CompleteCraft;
            _currentlyCrafting = queuedRecipe;
            if (OnCraftingBegin != null)
            {
                OnCraftingBegin(queuedRecipe.Recipe, queuedRecipe.ID);
            }
        }
 void timer1_Tick(object sender, EventArgs e)
 {
     if (StopWatch.Elapsed.Seconds > 4)
     {
         if (messageBanner.Location.Y < 0)
         {
             messageBanner.Location = new Point(41, 36);
             messageBanner.Text     = GetRandomMessage();
         }
         else
         {
             messageBanner.Location = new Point(41, messageBanner.Location.Y - 6);
             if (messageBanner.Location.X == 41 && messageBanner.Location.Y == 18)
             {
                 StopWatch.Reset();
                 StopWatch.Start();
             }
         }
     }
 }
Beispiel #31
0
        // Form repaint event.
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            // Refresh graphics/background.
            RefreshGraphics();

            // Refresh the clock.
            Clock MyClock = new Clock(
                ref GraphicsInterface,
                WidthPx / 2,
                HeightPx / 2);

            // Refresh the stopwatch.
            StopWatch MyStopwatch = new StopWatch(
                ref GraphicsInterface,
                WidthPx / 2,
                HeightPx / 2);


            MyFormPictureBox.Image = MyBitmap;
        }
Beispiel #32
0
    /**
     * 起動時に一度だけ実行
     */
    void Awake()
    {
        // プレハブ管理用クラスのインスタンス生成
        this.prefabManager = new PrefabManager();

        // カメラ操作用オブジェクトの取得
        this.camera = Camera.main.GetComponent <CameraScript>();

        // フェードアウトアニメーション取得
        GameObject cupsule = GameObject.Find("CameraCupsule");

        if (cupsule == null)
        {
            throw new UnityException("CameraCupsule is not found");
        }

        // アニメーション取得
        this.animation = cupsule.GetComponent <Animation>();
        if (this.animation == null)
        {
            throw new MissingComponentException("failed to get animation component");
        }
        else if (this.animation.GetClipCount() != 2)
        {
            throw new MissingComponentException("number of animation is not 2");
        }

        // フェードアウト及びフェードインアニメショーン取得
        this.fadeoutAnimationState = this.animation["FadeoutAnimation"];
        this.fadeinAnimationState  = this.animation["FadeinAnimation"];

        // ストップウォッチ
        this.stopWatch = this.GetComponent <StopWatch>();
        if (this.stopWatch == null)
        {
            throw new MissingComponentException("StopWatch is not found");
        }

        // 滞在データエディタの初期化(引数は取り扱う全プレハブ名)
        StayDataEditor.Initialize(this.prefabManager.GetAllPrefabNames());
    }
        public double UpdateDisplay(int frame)
        {
            var sw        = StopWatch.StartNew();
            int byteCount = 0;

            this.SelectFrame(frame);
            byteCount += 2;

            var flatBuffer = new List <byte>();

            for (var r = 0; r < MAX_HEIGHT; r++)
            {
                for (var c = 0; c < MAX_WIDTH; c++)
                {
                    flatBuffer.Add(_buffer[c, r]);
                }
            }

            var flatBufferIndex = 0;

            // 6x24=144
            for (uint8_t i = 0; i < 6; i++)
            {
                var command = (byte)(ISSI_PWM_REGISTER_LED0 + i * 24);
                var buffer  = new List <byte>();

                for (uint8_t j = 0; j < 24; j++)
                {
                    buffer.Add(flatBuffer[flatBufferIndex++]);
                }

                this.SendBuffer(command, buffer);
                byteCount += buffer.Count;
            }
            this.DisplayFrame(frame);
            byteCount += 2;
            sw.Stop();

            // Return number of byte / second
            return(byteCount / (sw.ElapsedMilliseconds / 1000.0));
        }
Beispiel #34
0
        private async void EventExtraTime_Clicked(object sender, EventArgs e)
        {
            var response = await DisplayAlert("Warning", "Are you sure?", "Yes", "Cancel");

            if (response)
            {
                try
                {
                    Task <string> resultTask = Event.Add(3, App.Game.Game.Id, StopWatch.ShowTime());
                    await         resultTask;

                    App.matchPart = "Extra Time";

                    await Navigation.PushAsync(new MatchPage(App.Game));
                }
                catch (Exception)
                {
                    await DisplayAlert("Error", "Communication error.", "OK");
                }
            }
        }
Beispiel #35
0
        public async Task <ErrorInfo> CheckUserAccess(string deviceId)
        {
            StopWatch.Start("ApiService.CheckUserAccess");

            HttpClient client = await GetClient();

            string result = await client.GetStringAsync(string.Format("{0}gofind2/markers.php?{1}", AppSettings.BaseHost, string.Format("dev_id={0}", deviceId)));

            ErrorInfo deserializedResult = JsonConvert.DeserializeObject <ErrorInfo> (result);

            if (deserializedResult == null)
            {
                deserializedResult = new ErrorInfo {
                    status = "allowed", message = "all right"
                };
            }

            StopWatch.Stop("ApiService.CheckUserAccess");

            return(deserializedResult);
        }
		public void StartStop()
		{
			var stopWatch = new StopWatch(new DummyRepository());

			Assert.AreEqual(0, stopWatch.GetLog().Length);
			stopWatch.Start(1);
			Assert.AreEqual(0, stopWatch.GetLog().Length);
			stopWatch.Start(1);
			Assert.AreEqual(1, stopWatch.GetLog().Length);
			stopWatch.Start(2);
			Assert.AreEqual(2, stopWatch.GetLog().Length);
			stopWatch.Stop("Done");
			Assert.AreEqual(3, stopWatch.GetLog().Length);

			stopWatch.Delete(stopWatch.GetLog()[0]);
			Assert.AreEqual(2, stopWatch.GetLog().Length);
			stopWatch.Delete(stopWatch.GetLog()[0]);
			Assert.AreEqual(1, stopWatch.GetLog().Length);
			stopWatch.Delete(stopWatch.GetLog()[0]);
			Assert.AreEqual(0, stopWatch.GetLog().Length);
		}
Beispiel #37
0
    void Update()
    {
        if (!active)
        {
            return;
        }
        if (!bin)
        {
            bin = GetComponentInChildren <CollectionBin>();
        }
        if (keysCreated < 3)
        {
            CreateKeys(3);
        }


        if (StopWatch.isRunning)
        {
            StopWatch.execute();
        }
    }
        public static void Testing()
        {
            var desService = new DirectionService();

            desService.SetCurrentDestination(new DirectToBKK());
            DisplayDirection(desService);

            desService.SetCurrentDestination(new DirectToHKT());
            DisplayDirection(desService);

            var abusingState = new StopWatch();

            abusingState.SetCurrentState(new RunningState(abusingState));
            Console.WriteLine("StopWatch State: {0}", abusingState.GetCurrentState());

            abusingState.SetCurrentState(new StopState(abusingState));
            Console.WriteLine("StopWatch State: {0}", abusingState.GetCurrentState());

            abusingState.SetCurrentState(new RunningState(abusingState));
            Console.WriteLine("StopWatch State: {0}", abusingState.GetCurrentState());
        }
        public static double TimeInputForHashST(HashTableOptions options)
        {
            var       file      = File.OpenRead("tale.txt");
            Scanner   scanner   = new Scanner(new StreamReader(file));
            StopWatch stopWatch = new StopWatch();
            IHashTable <string, int> hashTable = options switch
            {
                HashTableOptions.LinearProbiningHash => new LinearProbingHashST <string, int>(),
                HashTableOptions.SeparateChainingHash => new SeparateChainingHashST <string, int>(),
                _ => throw new Exception("Cannot find the options")
            };

            while (scanner.HasNext())
            {
                var word = scanner.Read();
                hashTable.Put(word, hashTable.Get(word) + 1);
            }
            double time = stopWatch.ElapsedTime;

            return(time);
        }
Beispiel #40
0
        public MultiItemResult <T> RunMultiItemQueryNamed <T>(MultiItemQueryFunc <T> f, string readerName, params object[] parms)
        {
            var sw = StopWatch.Start();

            try
            {
                StatusTextBroker.UpdateStatusText(DatabaseChannel, this, string.Format("{0} start reading.", readerName));

                using (var conn = this.GetOpenConnection())
                    return(new MultiItemResult <T>(f(conn, parms)));
            }
            catch (Exception e)
            {
                return(new MultiItemResult <T>(default(List <T>), e));
            }
            finally
            {
                sw.Stop();
                StatusTextBroker.UpdateStatusText(DatabaseChannel, this, string.Format("{0} finished reading, duration {1}", readerName, sw.Elapsed));
            }
        }
 public bool?TryStop()
 {
     using (EntryBlockUC entry = Lock.TryEnter())
     {
         if (entry.EntryTypeUC == EntryTypeUC.None)
         {
             return(null);
         }
         if (StopWatch == null)
         {
             return(false);                                   //disposed
         }
         if (!StopWatch.IsRunning)
         {
             return(true);
         }
         StopWatch.Stop();
         StopWatch.Reset();
         return(true);
     }
 }
Beispiel #42
0
        private string StopTimer()
        {
            StopWatch.Stop();
            ulong currentRunTime = (ulong)StopWatch.ElapsedMilliseconds;

            _totalRunCount++;
            StopWatch.Reset();

            if (currentRunTime == 0)
            {
                return(string.Empty);
            }

            _totalRunTime += currentRunTime;


            string timeStamp =
                $"Time Measure: +{currentRunTime:N0}ms, All runs count: {_totalRunCount:N0} times, All runs time: {_totalRunTime:N0}ms";

            return(timeStamp);
        }
Beispiel #43
0
        public Controller()
        {
            DisconnectedState = new DisconnectedState(this);
            ConnectingState   = new ConnectingState(this);
            ReadyState        = new ReadyState(this);
            ResettingState    = new ResettingState(this);
            AlarmedState      = new AlarmedState(this);
            AlarmKillState    = new AlarmKillState(this);
            HomingState       = new HomingState(this);
            JoggingState      = new JoggingState(this);
            JogCancelState    = new JogCancelState(this);
            RunningState      = new RunningState(this);
            RunHoldState      = new RunHoldState(this);
            RunResumeState    = new RunResumeState(this);
            RunCancelState    = new RunCancelState(this);

            queuedTriggerLock   = new object();
            receivedLines       = new Queue <string>();
            statusQueryTimeout  = new StopWatch();
            statusQueryInterval = DefaultStatusQueryInterval;
        }
Beispiel #44
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["class"] != null) {
            DateTime to = Utils.DateTimeNull;
            DateTime from = Utils.DateTimeNull;
            string className = Request["class"];
            if (Request["from"] != null) {
                from = new DateTime(long.Parse(Request["from"]));
            }
            if (Request["to"] != null) {
                to = new DateTime(long.Parse(Request["to"]));
            } else {
                to = DateTime.Now;
            }
            int grouping = 0;
            if (Request["grouping"] != null) {
                grouping = Utils.GetIntegerOnly(Request["grouping"]);
            }
            StopWatch stopWatch = new StopWatch();
            stopWatch.Start();
            Type elementType = Utils.GetType(className);
            var timeSeries = (ITimeSeriesAnalyticsElement)Activator.CreateInstance(elementType);
            var dataSeriesCollection = timeSeries.GetDataSeriesData(from, to,0,(DateGrouping)grouping);

            var dataArray = new object[dataSeriesCollection.Count];
            int counter = 0;
            foreach (var dataSeries in dataSeriesCollection) {
                IEnumerable<object[]> series = from coord in dataSeries.Data select new object[] { AnalyticsHelper.GetJavascriptTimestamp(coord.X), coord.Y };
                dataArray[counter] = new { data = series, label = dataSeries.Label };
                counter++;
            }
            stopWatch.Stop();
            Response.Clear();
            Response.ContentType = "application/json; charset=utf-8";
            Response.Write(JsonConvert.SerializeObject(dataArray));
            //Response.End();
            HttpContext.Current.ApplicationInstance.CompleteRequest();

        }
    }
		public void Run(StopWatch stopWatch)
		{
			stopWatch.Start();

			CheckPoint publishCheckpoint = stopWatch.Mark("Sending " + _repeatCount + " messages");
			CheckPoint receiveCheckpoint = stopWatch.Mark("Request/Response " + _repeatCount + " messages");

			for (int index = 0; index < _repeatCount; index++)
			{
				Guid transactionId = Guid.NewGuid();

				_bus.MakeRequest(x =>
					{
						x.Publish(new SimpleRequestMessage(transactionId));
						Interlocked.Increment(ref _requestCounter);
					})
					.When<SimpleResponseMessage>()
					.RelatedTo(transactionId)
					.IsReceived(msg =>
						{
							Interlocked.Increment(ref _responseCounter);

							if (_responseCounter == _repeatCount)
								_clientComplete.Set();
						})
					.OnTimeout(() => { })
					.TimeoutAfter(10.Seconds())
					.Send();
			}

			publishCheckpoint.Complete(_repeatCount);

			_handlerComplete.WaitOne(TimeSpan.FromSeconds(60), true);

			_clientComplete.WaitOne(TimeSpan.FromSeconds(60), true);

			receiveCheckpoint.Complete(_requestCounter + _responseCounter);

			stopWatch.Stop();
		}
Beispiel #46
0
		public void Run(StopWatch stopWatch)
		{
			stopWatch.Start();

			CheckPoint publishCheckpoint = stopWatch.Mark("Sending " + _repeatCount + " messages");
			CheckPoint receiveCheckpoint = stopWatch.Mark("Request/Response " + _repeatCount + " messages");

			for (int index = 0; index < _repeatCount; index++)
			{
				_bus.Publish(new GeneralMessage());
			}

			publishCheckpoint.Complete(_repeatCount);

			_completeEvent.WaitOne(TimeSpan.FromSeconds(60), true);

			_responseEvent.WaitOne(TimeSpan.FromSeconds(60), true);

			receiveCheckpoint.Complete(_requestCounter + _responseCounter);

			stopWatch.Stop();
		}
		public void Run(StopWatch stopWatch)
		{
			stopWatch.Start();

			CheckPoint publishCheckpoint = stopWatch.Mark("Sending " + _repeatCount + " messages");
			CheckPoint receiveCheckpoint = stopWatch.Mark("Request/Response " + _repeatCount + " messages");

			for (int index = 0; index < _repeatCount; index++)
			{
				Guid transactionId = Guid.NewGuid();

			    _bus.PublishRequest(new SimpleRequestMessage(transactionId), x =>
			        {
			            Interlocked.Increment(ref _requestCounter);

			            x.Handle<SimpleResponseMessage>(message =>
			                {
			                    Interlocked.Increment(ref _responseCounter);

			                    if (_responseCounter == _repeatCount)
			                        _clientComplete.Set();
			                });

			            x.HandleTimeout(10.Seconds(), () => { });
			        });
			}

			publishCheckpoint.Complete(_repeatCount);

			_handlerComplete.WaitOne(TimeSpan.FromSeconds(60), true);

			_clientComplete.WaitOne(TimeSpan.FromSeconds(60), true);

			receiveCheckpoint.Complete(_requestCounter + _responseCounter);

			stopWatch.Stop();
		}
		public void IntegrationTest()
		{
			var fileName = Path.Combine(Path.GetTempPath(), string.Format("tmp{0}.xml", Environment.TickCount));
			using (var stopWatch = new StopWatch(new FileSystemTimeTrackingRepository(fileName)))
			{
				Assert.AreEqual(0, stopWatch.GetLog().Length);
				Assert.AreEqual(null, stopWatch.GetCurrent());
				stopWatch.Start(1);
				Assert.AreEqual(0, stopWatch.GetLog().Length);
				Assert.AreEqual(1, stopWatch.GetCurrent().AssignableID);
			}
			using (var stopWatch = new StopWatch(new FileSystemTimeTrackingRepository(fileName)))
			{
				Assert.AreEqual(0, stopWatch.GetLog().Length);
				Assert.AreEqual(1, stopWatch.GetCurrent().AssignableID);
				stopWatch.Stop("Done");
				Assert.AreEqual(1, stopWatch.GetLog().Length);
				Assert.AreEqual(null, stopWatch.GetCurrent());
			}
			using (var stopWatch = new StopWatch(new FileSystemTimeTrackingRepository(fileName)))
			{
				Assert.AreEqual(1, stopWatch.GetLog().Length);
				Assert.AreEqual(null, stopWatch.GetCurrent());
				stopWatch.Start(2);
				Assert.AreEqual(1, stopWatch.GetLog().Length);
				Assert.AreEqual(2, stopWatch.GetCurrent().AssignableID);
			}
			using (var stopWatch = new StopWatch(new FileSystemTimeTrackingRepository(fileName)))
			{
				Assert.AreEqual(1, stopWatch.GetLog().Length);
				Assert.AreEqual(2, stopWatch.GetCurrent().AssignableID);
				stopWatch.Stop("Done");
				Assert.AreEqual(2, stopWatch.GetLog().Length);
				Assert.AreEqual(null, stopWatch.GetCurrent());
			}
			File.Delete(fileName);
		}
        protected override string GetCatalog()
        {
            string result = "\n" + CatalogFilename + ": ";
            ProgressText += result + "Extracting from web service...";
            var stopWatch = new StopWatch(true);
            var products = new List<ProductRecord>();

            //Note: the following attempts at getting custom results did not return category ids
            //			only the generic request was able to get the ids
            //			downside is that the generic request does not get all fields, so we have to make a second request per item to get missing fields
            //string query = "EDI_Name=Generic\\Products&SELECT_Columns=p.HideProduct,p.IsChildOfProductCode,p.ProductCode,p.ProductID,p.ProductName,p.ProductPopularity,p.StockStatus,p.ProductUrl,p.PhotoUrl,pe.Hide_When_OutOfStock,pe.ProductCategory,pe.ProductManufacturer,pe.PhotoURL_Small,pe.ProductPrice,pe.SalePrice,pe.UPC_code,pe.Google_Gender";
            //string query = "EDI_Name=Generic\\Products&SELECT_Columns=*";
            string query = null;
            try
            {
                GetCatalogXml(query);
            }
            catch (Exception ex)
            {
                result += ex.Message;
                if (ex.InnerException != null)
                    result += Environment.NewLine + ex.InnerException.Message;
                return result;
            }
            int numItems = (m_catalogXml == null)? 0 : m_catalogXml.Count();
            if (numItems == 0)
            {
                result += "There are no products in the catalog.";
                return result;
            }

            ProgressText += string.Format("completed ({0}){1}Parsing Product Catalog ({2} rows)...",
                                                                        stopWatch.Lap(), Environment.NewLine, numItems);
            string tempDisplay = ProgressText;

            //any extra fields not in the standard export will need to be requested from the API for each product
            string extraFields = "p.Photos_Cloned_From,p.IsChildOfProductCode";  //special cases needed to find images and remove children
            List<string> extraFieldList = GetRuleFields();
            if (extraFieldList.Count > 0)
            {
                //use the first product to find standard attributes and remove them from the list
                extraFieldList = extraFieldList.Where(x => (m_catalogXml.First().Descendants().Where(
                                                        y => y.Name.LocalName.Equals(x, StringComparison.CurrentCultureIgnoreCase)
                                                        ).DefaultIfEmpty(null).Single() == null)).ToList<string>();
                if (extraFieldList.Count > 0)
                    extraFields += ",pe." + extraFieldList.Aggregate((w, j) => string.Format("{0},pe.{1}", w, j));
                //Note:	Currently assuming that all fields are in pe table --true so far
                //An option would be to compile local lists of fields in each Volusion table and check against the lists
                //but then we may have to adjust for different version of Volusion
            }

            //create new replacement list in case child items are found
            m_replacementList = new List<ReplacementRecord>();
            int rows = 0;
            foreach (var product in m_catalogXml)
              {
                var p = new ProductRecord
                {
                    ProductId = Client.GetValue(product, "ProductCode"),
                                        Name =  Client.GetValue(product, "ProductName"),
                                        Att2Id = string.Empty,
                                        Price =  Client.GetValue(product, "ProductPrice"),
                                        SalePrice =  Client.GetValue(product, "SalePrice"),
                                        Filter = string.Empty
                };
            #if DEBUG
                string[] testProducts = { "calerachard10-w", "varnerfoxglovechard10-w", "mountedenchardwolff08-w", "viticciobere2008-w" };
                bool testFlag = false;
                if (testProducts.Contains(p.ProductId))
                    testFlag = true;
            #endif
                if (m_secondAttEnabled)
                    p.Att2Id = Client.GetValue(product, "ProductManufacturer");
                p.Link = string.Format("{0}/ProductDetails.asp?ProductCode={1}", "http://" + m_storeShortUrl, p.ProductId); //pdp link is never https
                p.Rating =  Client.GetValue(product, "ProductPopularity");
                p.StandardCode = Client.GetValue(product, "UPC_code");
                if (p.StandardCode.Length < 1)
                    p.StandardCode = p.ProductId;

                var categories = product.Descendants().Where(x => x.Name.LocalName.Equals("Categories", StringComparison.CurrentCultureIgnoreCase)).SingleOrDefault();
            if(categories != null)
            p.Att1Id = categories.Descendants("Category").Aggregate(string.Empty, (current, cat) => current + string.Format("{0},", cat.Descendants().Where(x => x.Name.LocalName.Equals("CategoryID")).Select(x => x.Value).DefaultIfEmpty("").Single())).TrimEnd(',');
            else
                    p.Att1Id = Client.GetValue(product, "CategoryIDs");

                //If extra fields not in the current export are required, call api to get the missing fields
                if (extraFields.Length > 0)
                {
                    try
                    {
                        query = string.Format("API_Name=Generic\\Products&SELECT_Columns={0}&WHERE_Column=p.ProductCode&WHERE_Value={1}",
                                                                        extraFields, p.ProductId);
                        XDocument extraXml = QueryVolusionApi(query);
                        if ((extraXml != null) && (extraXml.Root != null))
                        {
                            IEnumerable<XElement> ix = extraXml.Root.Elements("Products");
                            if (ix != null)
                                //remove any repetitive fields such as the product code
                                product.Add(ix.Descendants().Where(x => Client.GetValue(product, x.Name.ToString()).Length < 1));
                        }
                    }
                    catch
                    { }
                }

                //check to make sure this isn't a child
                string parentID = Client.GetValue(product, "IsChildOfProductCode");
                if ((parentID.Length > 0) && !parentID.Equals(p.ProductId)) //child so add to replacements
                    m_replacementList.Add(new ReplacementRecord { OldId = p.ProductId, NewId = parentID });

                //get the image link
                p.ImageLink = string.Empty;
                string imageID = Client.GetValue(product,"Photos_Cloned_From");
            #if DEBUG
                if (imageID.Length > 0) // cloned image found!
                    p.ImageLink = string.Empty; //just something to put a breakpoint on
            #endif
                if (imageID.Length < 1) //not using cloned image
                {
                    //try to pull image from dtabase fields (these appear to never have the image)
                    imageID = p.ProductId;
                    p.ImageLink = Client.GetValue(product, "PhotoURL_Small");
                    if (p.ImageLink.Length < 1)
                        p.ImageLink = Client.GetValue(product, "PhotoURL");
                }
                if (p.ImageLink.Length < 1) //build the image link from the imageID
                {
                    //replace illegal characters
                    string encodedID = imageID.Replace("/", "-fslash-").Replace(" ", "%20");
                    p.ImageLink = string.Format("{0}{1}-1.jpg", m_photoBaseUrl, encodedID);
                }

                //check category conditions, exclusions, and filters
                ApplyRules(ref p, product);

                products.Add(p);
                ProgressText = string.Format("{0}{1} rows completed ({2})", tempDisplay, ++rows, stopWatch.Lap());
            }
            ProgressText = string.Format("{0}Completed ({1}){2}Uploading to server...",
                                                                        tempDisplay, stopWatch.Lap(), Environment.NewLine);

            result += m_boostService.WriteTable(m_alias, CatalogFilename, products);
            ProgressText = string.Format("{0}({1})", result, stopWatch.Stop());
            return result;
        }
Beispiel #50
0
    IEnumerator LoadMore(List<Slice> lst)
    {
        StopWatch sw = new StopWatch ();

        // how large is selection in points?
        int lstPointCount = 0;
        foreach (Slice slice in lst) {
            lstPointCount += slice.size;
        }
        float stride = Mathf.Max (1.0f, (float)lstPointCount / (float)CloudMeshPool.PointCapacity);
        Debug.Log (string.Format ("Selection size: {0}, mesh pool size: {1}, stride: {2}",
                Pretty.Count (lstPointCount),
                Pretty.Count (CloudMeshPool.PointCapacity),
                stride));

        for(int i = 0; i < lst.Count; i++) {
            Slice slice = lst[i];
            guiMessage = slice.name + "...";
            binReader.SeekPoint (slice.offset, SeekOrigin.Begin);

            while (CloudMeshPool.HasFreeMeshes
                   && ((slice.offset + slice.size - binReader.PointPosition) > stride)) {
                int amount = Mathf.CeilToInt((float)(slice.offset + slice.size - binReader.PointPosition) / stride);
                if (amount > CloudMeshPool.pointsPerMesh)
                    amount = CloudMeshPool.pointsPerMesh;

                yield return StartCoroutine(CloudMeshPool.ReadFrom(binReader, stride, amount));

                if (CloudMeshPool.BufferFull) {
                    ProceduralUtils.InsertAtOrigin(CloudMeshPool.PopBuffer().transform, detailBranch.transform);
                    loadProgress = (float)detailBranch.transform.childCount / (float)CloudMeshPool.Capacity;
                }
            }
        }
        if ( !CloudMeshPool.BufferEmpty ) {
            ProceduralUtils.InsertAtOrigin(CloudMeshPool.PopBuffer().transform, detailBranch.transform);
            loadProgress = (float)detailBranch.transform.childCount / (float)CloudMeshPool.Capacity;
        }

        guiMessage = string.Format ("Loaded in {0}", Pretty.Seconds (sw.elapsed));
    }
Beispiel #51
0
 public RunnerContext(IAnnouncer announcer)
 {
     Announcer = announcer;
     StopWatch = new StopWatch();
 }
Beispiel #52
0
        public void ProxyPerformanceTests()
        {
            int runs = 5000000;
            StopWatch watch = new StopWatch();

            ITestObject testObject = new ChainableTestObject(null);
            using (watch.Start("Naked Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    object result = testObject.DoSomething(this);
                }
            }

            ITestObject hardcodedWrapper = new ChainableTestObject(testObject);
            using (watch.Start("Hardcoded Wrapper Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    object result = hardcodedWrapper.DoSomething(this);
                }
            }

            PeformanceTestAopContextInterceptor interceptor = new PeformanceTestAopContextInterceptor();
            ITestObject proxy = CreateProxy(testObject, interceptor, false);
            using(watch.Start("Proxy Duration ('ExposeProxy'==false): {0}"))
            {
                for(int i=0;i<runs;i++)
                {
                    object result = proxy.DoSomething(this);
                }
            }
            Assert.AreEqual(runs, interceptor.Calls);

            interceptor = new PeformanceTestAopContextInterceptor();
            proxy = CreateProxy(testObject, interceptor, true);
            using(watch.Start("Proxy Duration ('ExposeProxy'==true): {0}"))
            {
                for(int i=0;i<runs;i++)
                {
                    object result = proxy.DoSomething(this);
                }
            }
            Assert.AreEqual(runs, interceptor.Calls);
        }
Beispiel #53
0
 double measureWorkUnitsPerSecond(int noThreads, int testDurationMs, workUnit work, string caption)
 {
     int completedThreads = 0;
     object l = new object();
     int units = 0;
     StopWatch sw = new StopWatch();
     var go = new ThreadStart(
                         delegate() {
                             int u = 0;
                             try {
                                 while (sw.ElapsedMS < testDurationMs && !_break) {
                                     work();
                                     units++;
                                 }
                             } catch { }
                             lock (l) {
                                 completedThreads++;
                                 units += u;
                             }
                         }
                 );
     List<Thread> threads = new List<Thread>();
     for (int t = 0; t < noThreads; t++) threads.Add(new Thread(go));
     sw.Start();
     foreach (var t in threads) t.Start();
     while (completedThreads < noThreads) {
         _break = Info.BreakExecution;
         Thread.Sleep(50);
     }
     sw.Stop();
     return units / (sw.ElapsedMS / 1000);
 }
        protected string ApiTest()
        {
            string result = "\n" + CatalogFilename + ": ";
            string tempDisplay = ProgressText;
            ProgressText += result + "Rows to export...";
            StopWatch exportWatch = new StopWatch(true);

            #if MAGENTO_API_AVAILABLE
            #region Static Trevor
            if (static_proxy && m_alias.Equals("Trevor"))
            {
              MagentoService Mclient = new MagentoService();
              string MsessionId = "";

              //---------------------CATALOG EXPORT----------------------------
              try
              {
                MsessionId = Mclient.login(m_apiUserName, m_apiKey);
                catalogProductEntity[] plist = Mclient.catalogProductList(MsessionId, null, "");
                if (plist.Length < 1)
                  throw new Exception("No products available");

                //TODO: create catalog file header
                string type = "";
                foreach (catalogProductEntity p in plist)
                {
                  string pid = p.product_id;
                  if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                  {
                    bool isChild = false;
                    catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                    foreach (catalogProductLinkEntity pl in plinks)
                      if (pl.type.Equals("configurable"))
                      {
                        isChild = true;
                        break;
                      }
                    if (isChild) continue;
                  }
                  else
                    type += p.type + " ";

                  string pname = p.name;
                  string patt1 = "";
                  bool first = true;
                  foreach (string cid in p.category_ids)
                  {
                    if (first) first = false;
                    else patt1 += ",";
                    patt1 += cid;
                  }

                  catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", null, "id");
                  catalogProductReturnEntity pPriceInfo = Mclient.catalogProductGetSpecialPrice(MsessionId, pid, "", "id");
                  string patt2 = "";
                  string pprice = pPriceInfo.price; ;
                  if ((pPriceInfo.special_from_date != null) && (pinfo.special_to_date != null))
                  {
                    DateTime saleStart = DateTime.Parse(pPriceInfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pPriceInfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                      pprice = pPriceInfo.special_price;
                  }
                  string pfilter = "";
                  string plink = pinfo.url_key;
                  string pimage = "";
                  string psku = pinfo.sku;
                  catalogProductImageEntity pimageinfo = null;
                  try
                  {
                    pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                  }
                  catch { }
                  if (pimageinfo != null)
                  {
                    pimage = pimageinfo.url;
                  }
                }
              }
              catch { }

              //---------------------SALES EXPORT----------------------------
              try
              {
                //salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                if (sorders.Length > 0)
                {
                  //TODO: create header line for sales export
                  foreach (salesOrderEntity s in sorders)
                  {
                    string customerid = s.customer_id;
                    if (s.customer_is_guest.Equals("1"))
                    {
                      customerid = s.customer_email;
                      if (customerid == null || customerid.Length < 1)
                        customerid = s.increment_id;
                    }
                    string date = s.created_at;
                    salesOrderEntity sinfo = Mclient.salesOrderInfo(MsessionId, s.increment_id);
                    foreach (salesOrderItemEntity item in sinfo.items)
                    {
                      string productid = item.product_id;
                      string quantity = item.qty_ordered;
                      int len = quantity.IndexOf(".");
                      if (len > 0)
                        quantity = quantity.Substring(0, len); //remove fractional part

                      //TODO: add line to sales data here
                    }
                  }
                  //TODO: upload sales data
                }
              }
              catch { }
            }
            #endregion
            #endif

            #region Static GoStore
              Mage_Api_Model_Server_V2_HandlerPortTypeClient Mclient = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
              string MsessionId = "";

              //---------------------CATALOG EXPORT----------------------------
              try
              {
                //login
                    //MsessionId = Mclient.login(m_apiUserName, m_apiKey);
                    MsessionId = Mclient.login("4Tell", "4tellsoftware"); //condomania

                    //Get API calls available
                    apiEntity[] resources = Mclient.resources(MsessionId);
                    //resultObj = proxy.CallMethod("resources", sessionID);
                    //Type t = resultObj.GetType();
                    //XmlSerializer xs = new XmlSerializer(t);
                    //XElement resources = xs.SerializeAsXElement(resultObj);
                    //TODO: check each CallMethod to make sure it is in this list...

                    //Set product attributes to fetch
                catalogProductRequestAttributes prodAttributes = new catalogProductRequestAttributes();
                    string[] attributes = { "sku", "url_key", "price", "special_price", "special_from_date", "special_to_date", "parent_item_id" };
                prodAttributes.attributes = attributes;

                    //filters prodFilters = new filters();
                    //associativeEntity[] filterList = new associativeEntity[1];
                    //filterList[0].key = "";
                    //filterList[0].value = "";

                //loop through all products
                    StringBuilder data = new StringBuilder(CommonHeader + ProductRecord.Header());
                catalogProductEntity[] plist;
                Mclient.catalogProductList(out plist, MsessionId, null, "");
                string type = "";
                int maxCid = 0;
                foreach (catalogProductEntity p in plist)
                {
                  string pid = p.product_id;

                        if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                        {
                            //bool isChild = false;
                            //catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                            //foreach (catalogProductLinkEntity pl in plinks)
                            //  if (pl.type.Equals("configurable"))
                            //  {
                            //    isChild = true;
                            //    break;
                            //  }
                            //if (isChild) continue;
                        }
                        else
                            type += p.type + " ";

                  string pname = p.name;
                  string patt1 = "";
                  bool first = true;
                  foreach (string cid in p.category_ids)
                  {
                    if (first) first = false;
                    else patt1 += ",";
                    patt1 += cid;
                    int id = Convert.ToInt32(cid);
                    if (id > maxCid) maxCid = id;
                  }

                  string patt2 = "";
                  catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", prodAttributes, "id");
                  string pprice = pinfo.price; ;
                  if ((pinfo.special_from_date != null) && (pinfo.special_to_date != null))
                  {
                    DateTime saleStart = DateTime.Parse(pinfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pinfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                      pprice = pinfo.special_price;
                  }
                  string pfilter = "";
                  string plink = pinfo.url_key;
                  string pimage = "";
                  string psku = pinfo.sku;
                  catalogProductImageEntity pimageinfo = null;
                        try
                        {
                            pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                        }
                        catch
                        {
                            try
                            {
                                pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, psku, "", "", "sku");
                            }
                            catch
                            {
                            }
                        }
                        if (pimageinfo != null)
                        {
                            pimage = pimageinfo.url;
                        }
                  data.Append(pid + "\t" + pname + "\t" + patt1 + "\t" + patt2 + "\t" + pprice + "\t" + pfilter + "\t" + plink + "\t" + pimage + "\t" + psku + "\r\n");
                }
                    result += m_boostService.WriteTable(m_alias, CatalogFilename, data);

                //get cat info
                result += "\n" + Att1Filename + ": ";
                ProgressText = tempDisplay + result + "Exporting...";
                catalogCategoryInfo cinfo;
                    StringBuilder csb = new StringBuilder(CommonHeader + AttributeRecord.Header());
                for (int cid = 1; cid <= maxCid; cid++)
                {
                  try
                  {
                    cinfo = Mclient.catalogCategoryInfo(MsessionId, cid, "", null);
                    csb.Append(cid.ToString() + "\t" + cinfo.name + "\r\n");
                  }
                  catch
                  {
                    csb.Append(cid.ToString() + "\t" + cid.ToString() + "\r\n");
                  }
                }
                    result += m_boostService.WriteTable(m_alias, Att1Filename, csb);
                ProgressText = tempDisplay + result;
              }
              catch { }
                //try
                //{
                //  //catalogCategoryTree ctree = Mclient.catalogCategoryTree(MsessionId, "", "");
                //  catalogCategoryTree ctree = Mclient.catalogCategoryTree(MsessionId, "0", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //  catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //  catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryInfo cinfo = Mclient.catalogCategoryInfo(MsessionId, 0, "CurrentView", null);
                //  catalogCategoryInfo cinfo = Mclient.catalogCategoryInfo(MsessionId, 4, "", null);
                //}
                //catch { }
                //try
                //{
                //  //catalogProductAttributeSetEntity[] pasList = Mclient.catalogProductAttributeSetList(MsessionId);
                //  //...this one works!
                //  catalogProductAttributeSetEntity[] pasList = Mclient.catalogProductAttributeSetList(MsessionId);
                //}
                //catch { }

              //---------------------SALES EXPORT----------------------------
              try
              {
                    DateTime exportDate = DateTime.Now; //pass this date in
                    string salesFileName = string.Format(SalesFilenameFormat, exportDate.ToString("yyyy-MM"));
                    result += "\n" + salesFileName + ": ";
                    StringBuilder salesData = new StringBuilder(CommonHeader + SalesRecord.Header());

                    //create filter to get sales for this month only
                    string fromDate = string.Format("{0:0000}-{1:00}-01 00:00:00", exportDate.Year, exportDate.Month);
                    string toDate = string.Format("{0:0000}-{1:00}-01 00:00:00", exportDate.Year, exportDate.Month + 1);
                    filters monthFilter = new filters();
                    monthFilter.complex_filter = new complexFilter[2];
                    monthFilter.complex_filter[0] = new complexFilter();
                    monthFilter.complex_filter[0].key = "created_at";
                    monthFilter.complex_filter[0].value = new associativeEntity();
                    monthFilter.complex_filter[0].value.key = "from";
                    monthFilter.complex_filter[0].value.value = fromDate;
                    monthFilter.complex_filter[1] = new complexFilter();
                    monthFilter.complex_filter[1].key = "created_at";
                    monthFilter.complex_filter[1].value = new associativeEntity();
                    monthFilter.complex_filter[1].value.key = "to";
                    monthFilter.complex_filter[1].value.value = toDate;

                    //get list of sales orders
                salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, monthFilter);
                if (sorders.Length > 0)
                {
                  //TODO: create header line for sales export
                  foreach (salesOrderEntity s in sorders)
                  {
                    string customerid = s.customer_id;
                    if (s.customer_is_guest.Equals("1"))
                    {
                      customerid = s.customer_email;
                      if (customerid == null || customerid.Length < 1)
                        customerid = s.increment_id;
                    }
                    string date = s.created_at;
                            //get list of items purchased on each sales order
                    salesOrderEntity sinfo = Mclient.salesOrderInfo(MsessionId, s.increment_id);
                    foreach (salesOrderItemEntity item in sinfo.items)
                    {
                      string productid = item.product_id;
                      string quantity = item.qty_ordered;
                      int len = quantity.IndexOf(".");
                      if (len > 0)
                        quantity = quantity.Substring(0, len); //remove fractional part

                      //add line to sales data
                                salesData.Append(customerid + "\t" + productid + "\t" + quantity + "\t" + date + "\r\n");
                    }
                  }
                  //upload sales data
                        result += m_boostService.WriteTable(m_alias, salesFileName, salesData);

                }
              }
              catch { }
            #endregion

            return result;
        }
        public void TestLockingPerformanceImpact()
        {
            StopWatch watch = new StopWatch();
            object[] buckets = new object[10];
            
            int iterations = 10000000;

            IDictionary testDict = new Hashtable();
            buckets[5] = "value";
            object testResult;

            using(watch.Start("Normal Hashtable: {0}"))
            for(int i=0;i<iterations;i++)
            {
                testResult = buckets[6];
                buckets[5] = "value 2";
            }

            testDict = new Hashtable();
            testDict.Add( "key", "value" );
            using(watch.Start("Synced Hashtable: {0}"))
            for(int i=0;i<iterations;i++)
            {
                lock(buckets)
                {
                    testResult = buckets[6];                    
                }
                lock(buckets)
                {
                    buckets[5] = "value 2";
                }
            }
        }
Beispiel #56
0
    public override NextCall Invoke(WorkflowMethod invoker)
    {
        Info.InBackgroundMode = false;
        Info.Caption = "Running tests..";

        _data = new byte[1024 * 512];
        byte b = 0;
        for (int i = 0; i < _data.Length; i++) _data[i] = b++;

        List<test> tests = new List<test>();
        tests.Add(new test() { Name = "CPU", Devider = 10, DurationMS = 1000, Threads = 1, Work = cpuWork });
        tests.Add(new test() { Name = "CPU", Devider = 10, DurationMS = 1000, Threads = 2, Work = cpuWork });
        tests.Add(new test() { Name = "CPU", Devider = 10, DurationMS = 1000, Threads = 4, Work = cpuWork });
        tests.Add(new test() { Name = "CPU", Devider = 10, DurationMS = 1000, Threads = 16, Work = cpuWork });

        tests.Add(new test() { Name = "Filesystem", Devider = 2, DurationMS = 2000, Threads = 1, Work = fileSystemWork });
        tests.Add(new test() { Name = "Filesystem", Devider = 2, DurationMS = 2000, Threads = 2, Work = fileSystemWork });

        tests.Add(new test() { Name = "Database", Devider = 1, DurationMS = 5000, Threads = 1, Work = databaseWork });
        tests.Add(new test() { Name = "Database", Devider = 1, DurationMS = 5000, Threads = 4, Work = databaseWork });
        tests.Add(new test() { Name = "Database", Devider = 1, DurationMS = 5000, Threads = 8, Work = databaseWork });

        var totalDuration = tests.Sum(t => t.DurationMS);
        Info.EstimateProgress = true;
        StopWatch sw = new StopWatch();
        sw.Start();
        int n = 0;
        foreach (var t in tests) {
            Info.Caption = "Running test " + ++n + " of " + tests.Count + "...";
            Info.Description = "Testing " + t.Name + " - " + t.Threads + " thread" + (t.Threads == 1 ? "" : "s");
            t.Score = runTest(t);
            Info.SetProgress(sw.ElapsedMS, totalDuration);
            if (Info.BreakExecution) return null;
        }

        Info.Caption = "Test complete";
        Info.Description = "";

        StringBuilder report = new StringBuilder();
        report.AppendLine("<table>");
        report.AppendLine("<tr>");
        report.AppendLine("<td style=\"height:25px\"></td>");
        report.AppendLine("<td style=\"text-align:right;color:#444;width:50px;font-weight:bold\">Threads</td>");
        report.AppendLine("<td style=\"text-align:right;color:#444;width:100px;font-weight:bold\">Score</td>");
        report.AppendLine("</tr>");
        string last = null;
        foreach (var t in tests) {
            if (last != null && last != t.Name) {
                report.AppendLine("<tr><td style=\"height:15px\"></td></tr>");
            }
            report.AppendLine("<tr>");
            report.AppendLine("<td style=\"\">" + t.Name + "</td>");
            report.AppendLine("<td style=\"text-align:right\">" + t.Threads + "</td>");
            report.AppendLine("<td style=\"text-align:right\">" + t.Score.ToString("0.0") + "</td>");
            last = t.Name;
        }
        report.AppendLine("</table>");

        return new NextCall(new WMHtmlDialogue(DialogueIcon.Info, UIButtons.Ok, null, "Test result:", 400, 200, report.ToString()));
    }
Beispiel #57
0
            public override void Simulate()
            {
                try
                {
                    NRaas.SpeedTrap.Begin();

                    mTimer = StopWatch.Create(StopWatch.TickStyles.Minutes);
                    mTimer.Start();

                    while (true)
                    {
                        while ((mTimer != null) && (mTimer.GetElapsedTime() < mSaveInterval))
                        {
                            if (mExit)
                            {
                                break;
                            }
                            SpeedTrap.Sleep();
                        }

                        if (mTimer == null)
                        {
                            break;
                        }

                        Corrections.CorrectSaveGameLocks();

                        do
                        {
                            if (mExit)
                            {
                                break;
                            }
                            SpeedTrap.Sleep();
                        }
                        while (!IsValidState());

                        if (mExit)
                        {
                            break;
                        }

                        Saver.Save();

                        mTimer.Restart();
                    }

                    Destroy();
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception exception)
                {
                    Common.Exception("Simulate", exception);
                }
                finally
                {
                    NRaas.SpeedTrap.End();
                }
            }
Beispiel #58
0
 public override void Dispose()
 {
     if (mTimer != null)
     {
         mTimer.Dispose();
         mTimer = null;
     }
 }
        protected override string GetCatalog()
        {
            string result = "\n" + CatalogFilename + ": ";
            string tempDisplay = ProgressText;
            ProgressText += result + "Exporting catalog...";
            StopWatch exportWatch = new StopWatch(true);

            Mage_Api_Model_Server_V2_HandlerPortTypeClient Mclient = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
            string MsessionId = "";

            //---------------------CATALOG EXPORT----------------------------
            //errors caught by calling function

            //login
            MsessionId = Mclient.login(m_apiUserName, m_apiKey);

            //Set product attributes to fetch
            catalogProductRequestAttributes prodAttributes = new catalogProductRequestAttributes();
            string[] attributes = { "sku", "url_key", "price", "special_price", "special_from_date", "special_to_date", "parent_item_id" };
            prodAttributes.attributes = attributes;

            //loop through all products to build the list
            var products = new List<ProductRecord>();
            catalogProductEntity[] plist;
            Mclient.catalogProductList(out plist, MsessionId, null, "");
            int maxCid = 0;
            foreach (catalogProductEntity product in plist)
            {
                var p = new ProductRecord
                {
                    ProductId = product.product_id,
                    Name = product.name,
                };
                p.Att1Id = "";
                bool first = true;
                foreach (string cid in product.category_ids)
                {
                    if (first) first = false;
                    else p.Att1Id += ",";
                    p.Att1Id += cid;
                    int id = Convert.ToInt32(cid);
                    if (id > maxCid) maxCid = id;
                }

                p.Att2Id = "";
                catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, p.ProductId, "", prodAttributes, "id");
                p.Price = pinfo.price; ;
                if ((pinfo.special_from_date != null) && (pinfo.special_to_date != null))
                {
                    DateTime saleStart = DateTime.Parse(pinfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pinfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                        p.Price = pinfo.special_price;
                }
                p.Filter = "";
                p.Link = pinfo.url_key;
                p.ImageLink = "";
                catalogProductImageEntity[] pimageinfo = null;
                try
                {
                    pimageinfo = Mclient.catalogProductAttributeMediaList(MsessionId, pinfo.sku, "default", null);
                }
                catch { }
                if ((pimageinfo != null) && (pimageinfo.Length > 0))
                    p.ImageLink = pimageinfo[0].url;
                else
                {
                    p.ImageLink = string.Format(m_thumbnailFormat, pinfo.sku);
                }
                p.StandardCode = pinfo.sku;

            }

            ProgressText = tempDisplay + string.Format("Completed ({0}){1}Uploading to server...",
                                                                                                    exportWatch.Lap(), Environment.NewLine);
            var sb = new StringBuilder(CommonHeader + ProductRecord.Header());
            foreach (var product in products)
            {
                sb.Append(string.Format("{0}\t", product.ProductId));
                sb.Append(string.Format("{0}\t", product.Name));
                sb.Append(string.Format("{0}\t", product.Att1Id));
                sb.Append(string.Format("{0}\t", product.Att2Id));
                sb.Append(string.Format("{0}\t", product.Price));
                sb.Append(string.Format("{0}\t", product.SalePrice));
                sb.Append(string.Format("{0}\t", product.Rating));
                sb.Append(string.Format("{0}\t", product.Filter));
                sb.Append(string.Format("{0}\t", product.Link));
                sb.Append(string.Format("{0}\t", product.ImageLink));
                sb.Append(string.Format("{0}\r\n", product.StandardCode));
            }
            result += m_boostService.WriteTable(m_alias, CatalogFilename, sb);

            //get cat info
            result += "\n" + Att1Filename + ": ";
            ProgressText = tempDisplay + result + "Exporting category names...";
            catalogCategoryInfo cinfo;
            StringBuilder csb = new StringBuilder(CommonHeader + AttributeRecord.Header());
            for (int cid = 1; cid <= maxCid; cid++)
            {
                try
                {
                    cinfo = Mclient.catalogCategoryInfo(MsessionId, cid, "", null);
                    csb.Append(cid.ToString() + "\t" + cinfo.name + "\r\n");
                }
                catch
                {
                    csb.Append(cid.ToString() + "\t" + cid.ToString() + "\r\n");
                }
            }
            result += m_boostService.WriteTable(m_alias, Att1Filename, csb);
            ProgressText = tempDisplay + result;

            return result;
        }
        public void TestPeformanceImpactOfThrowingExceptions()
        {
            StopWatch watch = new StopWatch();

            int iterations = 1000000;

            using(watch.Start("Method returning exception: {0}"))
            for(int i=0;i<iterations;i++)
            {
                Exception ex = MethodReturnExceptionInformation();
            }
            
            using(watch.Start("Method throwing exception: {0}"))
            for(int i=0;i<iterations;i++)
            {
                Exception ex;
                try
                {
                    MethodThrowingException();
                }
                catch (Exception innerEx)
                {
                    ex = innerEx;
                }
            }
            
        }