def buildTrivialStatsTable(self, deltaSeriesCollection, klass=TRIVIAL_STATS_TABLE, style=''): """ Builds a html table with statistics for a collection of transactions :param deltaSeriesCollection: A series of elapsed time or pmc values for a pair of probes :param klass: Css selector for this table (Default value = TRIVIAL_STATS_TABLE) :param style: Css inline style attributes for this table (Default value = '') """ tableWrapper = HTML().div() klass = '{} {}'.format(TABLE_SUMMARY, klass) table = tableWrapper.table(border='1', klass=klass, style=style) self.buildStatsTableHeader(table) tbody = table.tbody for i, deltaSeries in enumerate(deltaSeriesCollection, 1): row = tbody.tr row.td('{0:,}'.format(i), klass=TD_KEY) row.td(deltaSeries.beginProbeName, klass=TD_KEY) row.td(deltaSeries.endProbeName, klass=TD_KEY) row.td(DURATION_FORMAT.format(deltaSeries.getMin())) row.td(DURATION_FORMAT.format(deltaSeries.getMax())) row.td(DURATION_FORMAT.format(deltaSeries.getMedian())) row.td(DURATION_FORMAT.format(deltaSeries.getMean())) row.td( DURATION_FORMAT.format( deltaSeries.getPercentile(self.percentile1))) row.td( DURATION_FORMAT.format( deltaSeries.getPercentile(self.percentile2))) row.td(DURATION_FORMAT.format(deltaSeries.getStandardDeviation())) return tableWrapper
def buildTimelineTable(self, timelineStats, probes, resultOrder, threshold, uid, logAbsoluteValues=False, logTimeline=False, logData=False): """ Builds a html table for timelines with common category and route :param timelineStats: A collection of timelines to be reported :param probes: List of probes in route taken by, the transaction collection :param resultOrder: Sort order for a collection of timelines :param threshold: Threshold for number of transactions rendered in html reports. :param logAbsoluteValues: Flag to enable reporting of absolute tsc values :param logTimeline: Flag to enable reporting of timeline details :param logData: Flag to enable logging of data associated with transaction """ begin = time.time() tableContainer = HTML().div(klass=TABLE_REPORT_CONTAINER) table = tableContainer.table(border='1', klass=TABLE_REPORT) self.buildBreakupTableHeader(table, probes, logAbsoluteValues, logTimeline, logData) tbody = table.tbody timelineCollection = self.reorderTimelineRecords(timelineStats.timelineCollection, resultOrder) #write table rows for i, timeline in enumerate(timelineCollection, 1): row = tbody.tr row.td('{0:,}'.format(i), klass=TD_KEY) row.td('{:,}'.format(timeline.txnId), klass=TD_KEY) if logData: row.td('{}'.format(timeline.data), klass=TD_KEY) row.td('{:,}'.format(timeline.inception), klass=TD_KEY) j = None for j, timepoint in enumerate(timeline): if logTimeline: row.td(DURATION_FORMAT.format(timepoint.point)) if j < len(timeline) -1: # skip the duration for the last time point, since it's always 0 self.buildTimepointCell(row, uid, i, j, timepoint) elif j < len(timeline) -1: # skip the duration for the last time point, since it's always 0 self.buildTimepointCell(row, uid, i, j, timepoint) self.buildTimepointCell(row, uid, i, j, timeline.endpoint, klass=TD_END) if logAbsoluteValues: for j, probe in enumerate(probes): counter = timeline.txn[j] if probe != counter.probe: from xpedite.types import InvariantViloation raise InvariantViloation( 'transaction {} does not match route {}'.format(timeline.txn, probes) ) tsc = counter.tsc if counter else '---' row.td('{}'.format(tsc), klass=TD_DEBUG) if i >= threshold: break elapsed = time.time() - begin if elapsed >= 5: LOGGER.completed('\tprocessed %d out of %d transactions | %0.2f%% complete', i, threshold, float(100 * float(i)/float(threshold)) ) begin = time.time() return tableContainer