示例#1
0
        /// <summary>
        /// 追加
        /// </summary>
        public override void Add()
        {
            Debug.WriteLine("m_PerformanceList.Count = " + Items.Count.ToString());

            Process[] _Process = Process.GetProcessesByName(m_InstanceName);
            Debug.WriteLine("_Process.Length         = " + _Process.Length.ToString());

            if (!Running)
            {
                return;
            }
            //------------------------
            // 値を取得し、履歴に登録
            //------------------------
            ArrayList _ValueList = new ArrayList();

            for (int i = 0; i < Items.Count; i++)
            {
                PerformanceCounterObject   _PerformanceCounterObject = Items.GetItem(i).Counter;
                PerformanceHistory <float> _PerformanceHistory       = Items.GetItem(i).History;
                float value = _PerformanceCounterObject.NextValue();
                _PerformanceHistory.Add(value);
                _ValueList.Add(value);
            }

            // ログ出力
            PrintLog(_ValueList);
        }
        /// <summary>
        /// 追加
        /// </summary>
        public override void Add()
        {
            Debug.WriteLine("=>>>> MemoryPerformanceChartTask::Add()");

            //------------------------
            // 値を取得し、履歴に登録
            //------------------------
            ArrayList _ValueList = new ArrayList();

            for (int i = 0; i < Items.Count; i++)
            {
                PerformanceCounterObject   _PerformanceCounterObject = Items[i].Counter;
                PerformanceHistory <float> _PerformanceHistory       = Items[i].History;
                float value = this.TotalVisibleMemorySize - _PerformanceCounterObject.NextValue();
                Debug.WriteLine("メモリ使用量:{0}", value);
                _PerformanceHistory.Add(value);
                _ValueList.Add(value);
            }
            this.ChartAreas[0].AxisY.Minimum  = 0; // 縦軸の最小値を0にする
            this.ChartAreas[0].AxisY.Maximum  = this.TotalVisibleMemorySize;
            this.ChartAreas[0].AxisY.Interval = 1000;

            // ログ出力
            PrintLog(_ValueList);

            Debug.WriteLine("<<<<= MemoryPerformanceChartTask::Add()");
        }
        public void no_hits_means_zero_exception_percentage_and_zero_average()
        {
            var history = new PerformanceHistory();

            history.Average.ShouldBe(0);
            history.ExceptionPercentage.ShouldBe(0);
        }
        /// <summary>
        /// 追加
        /// </summary>
        public override void Add()
        {
            if (!Running)
            {
                return;
            }
            //------------------------
            // 値を取得し、履歴に登録
            //------------------------
            ArrayList _ValueList = new ArrayList();
            float     _MaxValue  = 10.0F;

            for (int i = 0; i < Items.Count; i++)
            {
                PerformanceCounterObject   _PerformanceCounterObject = Items[i].Counter;
                PerformanceHistory <float> _PerformanceHistory       = Items[i].History;
                float value = _PerformanceCounterObject.NextValue();
                _PerformanceHistory.Add(value);
                _ValueList.Add(value);

                if (_PerformanceHistory.Max > _MaxValue)
                {
                    _MaxValue = _PerformanceHistory.Max;
                }
            }
            this.ChartAreas[0].AxisY.Maximum  = _MaxValue;
            this.ChartAreas[0].AxisY.Interval = (int)(_MaxValue / 10);

            // ログ出力
            PrintLog(_ValueList);
        }
        public void read_increments_hit_count()
        {
            var history = new PerformanceHistory();

            for (var i = 0; i < 10; i++)
            {
                history.Read(new StubRequestLog());
                history.HitCount.ShouldBe(i + 1);
            }
        }
        public void read_stores_the_last_execution()
        {
            var history = new PerformanceHistory();
            var log1    = new ChainExecutionLog();
            var log2    = new ChainExecutionLog();

            history.Read(log1);
            history.LastExecution.ShouldBeTheSameAs(log1);

            history.Read(log2);
            history.LastExecution.ShouldBeTheSameAs(log2);
        }
        public void calculate_average()
        {
            var history = new PerformanceHistory();

            history.Read(new StubRequestLog {
                ExecutionTime = 100
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 200
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 50
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 70
            });

            history.Average.ShouldBe((100 + 200 + 50 + 70) / 4);
        }
        public void increment_total_time()
        {
            var history = new PerformanceHistory();

            history.Read(new StubRequestLog {
                ExecutionTime = 100
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 200
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 50
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 70
            });

            history.TotalExecutionTime.ShouldBe(100 + 200 + 50 + 70);
        }
        public void calculate_exception_percentage()
        {
            var history = new PerformanceHistory();


            history.Read(new StubRequestLog {
                ExecutionTime = 100
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 200, HadException = true
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 50
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 70, HadException = true
            });
            history.Read(new StubRequestLog {
                ExecutionTime = 70
            });

            history.ExceptionPercentage.ShouldBe(40);
        }
        public void read_increments_exception_count_correctly()
        {
            var history = new PerformanceHistory();

            history.Read(new StubRequestLog {
                HadException = false
            });
            history.ExceptionCount.ShouldBe(0);

            history.Read(new StubRequestLog {
                HadException = true
            });
            history.ExceptionCount.ShouldBe(1);

            history.Read(new StubRequestLog {
                HadException = true
            });
            history.ExceptionCount.ShouldBe(2);

            history.Read(new StubRequestLog {
                HadException = false
            });
            history.ExceptionCount.ShouldBe(2);
        }
        public void track_max_time()
        {
            var history = new PerformanceHistory();

            history.Read(new StubRequestLog {
                ExecutionTime = 100
            });
            history.MaxTime.ShouldBe(100);

            history.Read(new StubRequestLog {
                ExecutionTime = 200
            });
            history.MaxTime.ShouldBe(200);

            history.Read(new StubRequestLog {
                ExecutionTime = 50
            });
            history.MaxTime.ShouldBe(200);

            history.Read(new StubRequestLog {
                ExecutionTime = 70
            });
            history.MaxTime.ShouldBe(200);
        }