//
        // ctor
        //

        #region public PDFPerformanceMonitorMeasurement(PDFPerformanceMonitorEntry owner, string key)

        /// <summary>
        /// Creates a new instance of a measurement with the owner (cannot be Null) and key
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="key"></param>
        /// <remarks>Easiest way to create and start a meausurement is to use the entries.Record(key) method in a using block</remarks>
        public PDFPerformanceMonitorMeasurement(PDFPerformanceMonitorEntry owner, string key)
        {
            this._owner = owner;
            this._start = owner.MonitorElapsed;
            this._end   = TimeSpan.Zero;
            if (null == key)
            {
                key = string.Empty;
            }
            this._key = key;
        }
Пример #2
0
        private void AddPerformanceEntry(TableGrid grid, PDFPerformanceMonitorEntry entry)
        {
            TableRow row = new TableRow();

            grid.Rows.Add(row);

            TableCell cell = new TableCell()
            {
                DataStyleIdentifier = "PerfCategoryKey"
            };

            cell.Contents.Add(new TextLiteral(entry.MonitorKey));
            row.Cells.Add(cell);

            cell = new TableCell()
            {
                StyleClass = "number", DataStyleIdentifier = "PerfCategoryEntryRight"
            };
            cell.Contents.Add(new TextLiteral(entry.MonitorElapsed.TotalMilliseconds.ToString("#,##0.00")));
            row.Cells.Add(cell);

            cell = new TableCell()
            {
                StyleClass = "number", DataStyleIdentifier = "PerfCategoryEntryRight"
            };
            cell.Contents.Add(new TextLiteral(entry.MonitorCount.ToString()));
            row.Cells.Add(cell);

            if (entry.HasMeasurements)
            {
                foreach (PDFPerformanceMonitorMeasurement measure in entry.GetMeasurements())
                {
                    this.AddPerformanceMeasurement(grid, measure);
                }
            }
        }