Beispiel #1
0
 def __repr__(self):
   from xpedite.util import makeUniqueId
   from xpedite.report.reportbuilder   import ReportBuilder
   from xpedite.types                  import ResultOrder
   if self.profile:
     uid = makeUniqueId()
     strRepr = ReportBuilder().buildPmuScript(
       self.profile.current.timelineCollection, uid
     ) if self.profile.current.isEventsEnabled() else ''
     threshold = 1000
     if len(self.profile.current) > threshold:
       LOGGER.warn('too many transaction - showing only %d out of %d', threshold, len(self.profile.current))
     strRepr += str(ReportBuilder().buildTimelineTable(
       self.profile.current, self.profile.probes, ResultOrder.Chronological, threshold, uid
     ))
     display(HTML(strRepr))
   return ''
Beispiel #2
0
    def buildReport(self,
                    timelineStats,
                    benchmarkTlsMap,
                    probes,
                    category,
                    resultOrder,
                    threshold,
                    logAbsoluteValues=False,
                    logTimeline=False,
                    logData=False):
        """
    Builds latency constituent report with statistics, visualizations and timeline table

    :param timelineStats: Time line and duration series statistics
    :type timelineStats: xpedite.analytics.timeline.TimelineStats
    :param benchmarkTlsMap: Time line and duration series statistics for benchmarks
    :param probes: List of probes in route, taken by the transaction collection
    :param category: Category of the transactions in this profile
    :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

    """
        uid = makeUniqueId()
        tableContainer = self.buildTimelineTable(timelineStats, probes,
                                                 resultOrder, threshold, uid,
                                                 logAbsoluteValues,
                                                 logTimeline, logData)
        timelineCollection = self.reorderTimelineRecords(
            timelineStats.timelineCollection, resultOrder)
        pmuScript = self.buildPmuScript(timelineCollection, uid)

        flotBuilder = FlotBuilder()
        flotMarkup = flotBuilder.buildBenchmarkFlot(category, timelineStats,
                                                    benchmarkTlsMap)
        statsReport = StatsBuilder().buildStatsTable(category, timelineStats,
                                                     benchmarkTlsMap)

        reportTitle = HTML().h3('{} Transaction Time lines'.format(category))

        return (HTML_BEGIN + statsReport + flotMarkup + str(reportTitle) +
                pmuScript + str(tableContainer) + HTML_END)
Beispiel #3
0
def buildPmcPlot(timeline):
    """Builds a visaulizaton for correlating pmu metrics with sections of code"""
    from xpedite.jupyter.templates import loadTxnPmcMarkup
    from xpedite.util import makeUniqueId
    from xpedite.report.markup import VIZ
    try:
        pmcCount = len(timeline[0].pmcNames) if timeline[0].pmcNames else 0
        if pmcCount <= 0:
            return None
        pmcBarScale = 100 / pmcCount  #get scale size
        pmuJson, plotLabelsJson, pmcSumJson = buildPmcJson(
            timeline, pmcBarScale)
        bipartiteHtml = loadTxnPmcMarkup()
        uid = makeUniqueId()
        bipartiteHtml = bipartiteHtml % (uid, VIZ, pmuJson, plotLabelsJson,
                                         pmcSumJson, pmcBarScale, pmcCount,
                                         uid)
        return bipartiteHtml
    except Exception as ex:
        return str(ex)
Beispiel #4
0
    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
Beispiel #5
0
    def buildPMUFlot(self, category, timelineStats):
        """
    Builds line charts for pmc data from current profile session

    :param category: Category of transactions visualized by this flot
    :param timelineStats: Timeline stats with delta series to be plotted

    """
        uid = 'pmu_{}'.format(makeUniqueId())
        flotData = []
        tscDeltaSeriesCollection = timelineStats.getTscDeltaSeriesCollection()
        for i, _ in enumerate(tscDeltaSeriesCollection):
            series = [('wall time(us)', tscDeltaSeriesCollection[i])]
            deltaSeriesRepo = timelineStats.deltaSeriesRepo
            for eventName in deltaSeriesRepo.eventNames:
                series.append((eventName, deltaSeriesRepo[eventName][i]))
            seriesMap = FlotBuilder.buildFlotSeriesMap(series, uid)
            flotData.append(seriesMap)
        return self.buildFlot(category,
                              'PMU Counters',
                              timelineStats,
                              uid,
                              flotData,
                              flotChoiceName='pmu counter')
Beispiel #6
0
    def buildBenchmarkFlot(self, category, timelineStats, benchmarkTlsMap):
        """
    Builds line charts for data from current profile session side by side with benchmarks

    :param category: Category of transactions visualized by this flot
    :param timelineStats: Timeline stats with delta series to be plotted
    :param benchmarkTlsMap: Timeline stats for all the loaded benchmarks

    """
        uid = 'benchmark_{}'.format(makeUniqueId())
        flotData = []
        tscDeltaSeriesCollection = timelineStats.getTscDeltaSeriesCollection()
        for i, _ in enumerate(tscDeltaSeriesCollection):
            series = [(timelineStats.name, tscDeltaSeriesCollection[i])]
            for benchmarkName, benchmarkTls in benchmarkTlsMap.iteritems():
                series.append((benchmarkName,
                               benchmarkTls.getTscDeltaSeriesCollection()[i]))
            seriesMap = FlotBuilder.buildFlotSeriesMap(series, uid)
            flotData.append(seriesMap)
        flot = self.buildFlot(category, 'Transaction latency', timelineStats,
                              uid, flotData)
        if timelineStats.isEventsEnabled():
            flot += self.buildPMUFlot(category, timelineStats)
        return flot