def buildEnvironmentReportFile(self, app, repo, resultOrder, classifier, txnFilter, benchmarkPaths): """ Creates a file to store the markup for environment details :param app: an instance of xpedite app, to interact with target application :param repo: repository of transactions for current profiling sessions and benchmarks :param resultOrder: Sort order of transactions in latency constituent reports :param classifier: Predicate to classify transactions into different categories :param txnFilter: Lambda to filter transactions prior to report generation :param benchmarkPaths: List of stored reports from previous runs, for benchmarking """ from xpedite.report.profileInfo import ProfileInfoReportBuilder from xpedite.report.tabs import (TAB_HEADER_FMT, TAB_BODY_FMT, TAB_BODY_PREFIX, TAB_BODY_SUFFIX, TAB_JS, TAB_CONTAINER_FMT, tabState, tabContentState) envTable = self.buildEnvironmentTable(app) cpuInfoTable = self.buildCpuInfoTable(app) hostReport = '' if envTable: title = HTML().h3('Test Environment parameters') hostReport += str(title) + str(envTable) if cpuInfoTable: title = HTML().h3('Test Environment cpu info') hostReport += str(title) + str(cpuInfoTable) profileReport = ProfileInfoReportBuilder().buildProfileInfoReportFile( app, repo, resultOrder, classifier, txnFilter, benchmarkPaths) tabHeader = TAB_HEADER_FMT.format('hostInfo', tabState(True), 'Host Info') tabHeader += TAB_HEADER_FMT.format('profileInfo', tabState(False), 'Profile Info') envBodyClass = 'envInfoBody ' tabBody = TAB_BODY_FMT.format('hostInfo', envBodyClass + tabContentState(True), hostReport) tabBody += TAB_BODY_FMT.format('profileInfo', envBodyClass + tabContentState(False), profileReport) tabBody = TAB_BODY_PREFIX + tabBody + TAB_BODY_SUFFIX report = (HTML_BEGIN + TAB_CONTAINER_FMT.format(tabHeader, tabBody) + TAB_JS + HTML_END) return report
def buildStatsTable(self, category, timelineStats, benchmarkTlsMap): """ Builds a table with statistics for current profile session side by side with benchmarks :param category: Category of transactions in the given timelineStats :param deltaSeriesCollection: A series of elapsed time or pmc values for a pair of probes :param benchmarkTlsMap: Timeline statitics for benchmarks """ statsReport = str( self.buildStatsTitle(category, benchmarkTlsMap.keys(), len(timelineStats))) if len(timelineStats.deltaSeriesRepo) > 1: tabHeader = '' tabBody = '' tableCount = 0 for eventName, deltaSeriesCollection in timelineStats.deltaSeriesRepo.items( ): tabId = '{}_{}'.format(eventName, makeUniqueId()) tabId = tabId.replace(' ', '_').replace('.', '_').replace(':', '_') tabHeader += TAB_HEADER_FMT.format(tabId, tabState(tableCount == 0), eventName) table = self._buildStatsTable(eventName, deltaSeriesCollection, benchmarkTlsMap) tabBody += TAB_BODY_FMT.format( tabId, tabContentState(tableCount == 0), table) tableCount += 1 tabBody = TAB_BODY_PREFIX + tabBody + TAB_BODY_SUFFIX statsReport += TAB_CONTAINER_FMT.format(tabHeader, tabBody) + TAB_JS else: deltaSeriesCollection = timelineStats.getTscDeltaSeriesCollection() statsReport += self._buildStatsTable(TSC_EVENT_NAME, deltaSeriesCollection, benchmarkTlsMap) return statsReport