Beispiel #1
0
        public static void BeginMensure(string Name)
        {
            PerformanceItem item;

            if (_list.ContainsKey(Name))
            {
                item = _list[Name];
                item.PreviousTime = DateTime.Now.Ticks;
            }
            else
            {
                item = new PerformanceItem();
#if !WINRT
                var        stackTrace = new StackTrace();
                var        stackFrame = stackTrace.GetFrame(1);
                MethodBase methodBase = stackFrame.GetMethod();

                item.Name = "ID: " + Name + " In " + methodBase.ReflectedType.ToString() + "::" + methodBase.Name;
#else
                item.Name = "ID: " + Name;
#endif
                item.PreviousTime = DateTime.Now.Ticks;
                _list.Add(Name, item);
            }
        }
Beispiel #2
0
        public static void EndMensure(string Name)
        {
            PerformanceItem item        = _list[Name];
            var             elapsedTime = DateTime.Now.Ticks - item.PreviousTime;

            if (item.MaxTime < elapsedTime)
            {
                item.MaxTime = elapsedTime;
            }
            item.TotalTime += elapsedTime;
            item.HitCount++;
        }
Beispiel #3
0
        public static void EndMensure(string Name)
        {
            PerformanceItem item        = _list[Name];
            long            elapsedTime = Environment.TickCount - item.PreviousTime;

            if (item.MaxTime < elapsedTime)
            {
                item.MaxTime = elapsedTime;
            }
            item.TotalTime += elapsedTime;
            item.HitCount++;
        }
        public static void BeginMensure(string Name)
        {
            PerformanceItem item;
            if (_list.ContainsKey(Name))
            {
                item = _list[Name];
                item.PreviousTime = Environment.TickCount;
            }
            else
            {
                StackTrace stackTrace = new StackTrace();
                StackFrame stackFrame = stackTrace.GetFrame(1);
                MethodBase methodBase = stackFrame.GetMethod();

                item = new PerformanceItem();
                item.Name = "ID: " + Name+" In " + methodBase.ReflectedType.ToString()+"::"+methodBase.Name;
                item.PreviousTime = Environment.TickCount;
                _list.Add(Name,item);
            }
        }
Beispiel #5
0
        public static void BeginMensure(string Name)
        {
            PerformanceItem item;

            if (_list.ContainsKey(Name))
            {
                item = _list[Name];
                item.PreviousTime = Environment.TickCount;
            }
            else
            {
                StackTrace stackTrace = new StackTrace();
                StackFrame stackFrame = stackTrace.GetFrame(1);
                MethodBase methodBase = stackFrame.GetMethod();

                item              = new PerformanceItem();
                item.Name         = "ID: " + Name + " In " + methodBase.ReflectedType.ToString() + "::" + methodBase.Name;
                item.PreviousTime = Environment.TickCount;
                _list.Add(Name, item);
            }
        }
Beispiel #6
0
        public static void EndMensure(string Name)
        {
            if (!_list.ContainsKey(Name))
            {
                return;
            }
            PerformanceItem item        = _list[Name];
            long            elapsedTime = Environment.TickCount - item.PreviousTime;

            if (item.MaxTime < elapsedTime)
            {
                item.MaxTime = elapsedTime;
                item.MaxAt   = item.HitCount;
            }
            item.HitCount++;
            item.TotalTime += elapsedTime;

            var diff = elapsedTime - ((double)item.TotalTime / item.HitCount);

            item.SqrDiffSum += diff * diff;
        }
		public static void BeginMensure(string Name)
		{			
			PerformanceItem item;
			if (_list.ContainsKey(Name))
			{
				item = _list[Name];
                item.PreviousTime = DateTime.UtcNow.Ticks;		
			}
			else 
			{
				item = new PerformanceItem();
#if !WINRT
    			var stackTrace = new StackTrace();
    			var stackFrame = stackTrace.GetFrame(1);
    			MethodBase methodBase = stackFrame.GetMethod();

				item.Name = "ID: " + Name+" In " + methodBase.ReflectedType.ToString() + "::" + methodBase.Name;
#else
                item.Name = "ID: " + Name;
#endif
                item.PreviousTime = DateTime.UtcNow.Ticks;
                _list.Add(Name,item);
			}			
		}