// // .ctor // #region public PDFPerformanceMonitorEntry(PerformanceMonitorType type) /// <summary> /// Creates a new performance monitor entry for recording timings against a particular monitor type /// </summary> /// <param name="type"></param> /// <param name="recordItems"></param> public PDFPerformanceMonitorEntry(PerformanceMonitorType type, bool recordMeasurements) { this._type = type; this._timer = new System.Diagnostics.Stopwatch(); this._indexer = 0; this._recordMeasurements = recordMeasurements; }
/// <summary> /// Sets up the array of entries - called from the constructor /// </summary> protected virtual void InitEntries(bool recordMeasurements) { int len = (int)PerformanceMonitorType.Count; _entries = new PDFPerformanceMonitorEntry[len]; for (int i = 0; i < len; i++) { PerformanceMonitorType type = (PerformanceMonitorType)i; _entries[i] = new PDFPerformanceMonitorEntry(type, recordMeasurements); } }
// // properties // #region public PDFPerformanceMonitorEntry this[PerformanceMonitorType type] /// <summary> /// Gets access to each monitor entry based on the performance monitor type /// </summary> /// <param name="type">The type of the monitor</param> /// <returns>An entry that holds the timing details</returns> public PDFPerformanceMonitorEntry this[PerformanceMonitorType type] { get { return(_entries[(int)type]); } }
/// <summary> /// Starts the recording of the performance monitor entry associated with the specified type, and encapsualtes the /// duration associated with the profided key within the entry. /// </summary> /// <param name="type"></param> /// <param name="key"></param> /// <returns>An IDisposable instance that when disposed will stop the recording against the entry and key</returns> public IDisposable Record(PerformanceMonitorType type, string key) { return(this[type].Record(key)); }
/// <summary> /// Stops the recording of the performance monitor entry associated with the provided type /// </summary> /// <param name="type"></param> public void End(PerformanceMonitorType type) { this[type].End(); }
// // public methods // #region public void Begin(PerformanceMonitorType type) /// <summary> /// Starts the recording of the performance monitor entry associated with the provided type /// </summary> /// <param name="type"></param> public void Begin(PerformanceMonitorType type) { this[type].Begin(); }