コード例 #1
0
ファイル: Router.cs プロジェクト: 00mjk/Router-1
 protected virtual void OnHourClickerTrim(RouterClickBase head)
 {
     // no op, in your sub class you may choose to presist them some where
 }
コード例 #2
0
ファイル: Router.cs プロジェクト: 00mjk/Router-1
        protected virtual void OnMinuteClickerTrim(RouterClickBase head)
        {
            // roll up totals into hours
            int totalExecuted = 0;
            int totalResolved = 0;

            double totalExecutionTime = 0;
            double totalResolveTime   = 0;

            double averageExecutionTime = 0;
            double averageResolveTime   = 0;


            RouterClickBase curr = head;

            while (curr != null)
            {
                switch (curr.ClickType)
                {
                case RouterClickBase.Execute_ClickType:
                {
                    totalExecutionTime += curr.Value;
                    ++totalExecuted;
                    break;
                }

                case RouterClickBase.Resolve_ClickType:
                {
                    totalResolveTime += curr.Value;
                    ++totalResolved;
                    break;
                }
                }

                curr = (RouterClickBase)curr.Next;
            }

            // Collect and rollup

            averageExecutionTime = totalExecuted == 0 ? 0 : totalExecutionTime / totalExecuted;
            averageResolveTime   = totalResolved == 0 ? 0 : totalResolveTime / totalResolved;


            if (0 != totalExecuted)
            {
                mHourClicker.Click(new RouterClickBase()
                {
                    ClickType = RouterClickBase.TotalExecuted_ClickType, Value = totalExecuted
                });
            }

            if (0 != totalResolved)
            {
                mHourClicker.Click(new RouterClickBase()
                {
                    ClickType = RouterClickBase.TotalResolved_ClickType, Value = totalResolved
                });
            }


            if (0 != averageExecutionTime)
            {
                mHourClicker.Click(new RouterClickBase()
                {
                    ClickType = RouterClickBase.AvgExecuteTime_ClickType, Value = averageExecutionTime
                });
            }

            if (0 != averageResolveTime)
            {
                mHourClicker.Click(new RouterClickBase()
                {
                    ClickType = RouterClickBase.AvgResolveTime_ClickType, Value = averageResolveTime
                });
            }
        }