コード例 #1
0
        public void WriteTimers()
        {
            TimeSpan total = TimeSpan.Zero;

            foreach (KeyValuePair <string, TimeSpan> timer in this.totalElapsedTimeByName)
            {
                if (timer.Value > TimeSpan.Zero)
                {
                    Debug.WriteLine("Profile: " + timer.Key + " " + DebugTimer.TimeStr(timer.Value));
                }
                total += timer.Value;
            }
            Debug.WriteLine("Profile: total time elapsed under debug timers " + DebugTimer.TimeStr(total) + ".");
        }
コード例 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (this.isDisposed == false)
            {
                if (disposing)
                {
                    TimeSpan elapsed = this.Elapsed();
                    this.parent.AddTime(this.name, elapsed);
                    // show message if timer is not set to silent, and if time > 100ms (if timer is set to hideShort (which is the default))
                    if (this.IsSilent == false && (this.HideShort == false || elapsed.TotalSeconds > 1.0))
                    {
                        Debug.WriteLine("Timer " + name + ": " + DebugTimer.TimeStr(this.Elapsed()));
                    }
                }

                this.isDisposed = true;
            }
        }