コード例 #1
0
        public PerformanceRecordFactory(IPerformanceTimerFactory timerFactory)
        {
            if (timerFactory == null)
            {
                throw new ArgumentNullException("timerFactory");
            }

            _timerFactory = timerFactory;
        }
コード例 #2
0
ファイル: PerformanceRecord.cs プロジェクト: lsoft/Proxy
        public PerformanceRecord(
            string className,
            string methodName,
            IPerformanceRecordFactory recordFactory,
            IPerformanceTimerFactory timerFactory,
            IPerformanceRecord parent)
        {
            if (className == null)
            {
                throw new ArgumentNullException("className");
            }
            if (methodName == null)
            {
                throw new ArgumentNullException("methodName");
            }
            if (recordFactory == null)
            {
                throw new ArgumentNullException("recordFactory");
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException("timerFactory");
            }

            //parent allowed to be null


            _className = className;
            _methodName = methodName;
            _recordFactory = recordFactory;
            _parent = parent;

            Active = true;
            _diedChildren = new List<IPerformanceRecord>();

            var creationStack = new StackTrace(1, true).ToString(); //единица подобрана так, чтобы "служебные" фреймы перформанса не попадали в стек
            _creationStack = string.IsInterned(creationStack) ?? creationStack; //memory economy

            //Запоминаем время
            _startTime = timerFactory.GetCurrentTime();
            _timer = timerFactory.CreatePerformanceTimer();
        }