Esempio n. 1
0
def generate(app, profiles, histograms, resultOrder, classifier, txnFilter, benchmarkPaths, reportThreshold):
  """
  Generates latency breakup reports for a list of profiles

  :param app: an instance of xpedite app, to interact with target application
  :param profiles: Profile data for the current profile session
  :param histograms: Latency distribuion histograms for each category/route combination
  :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
  :param reportThreshold: Threshold for number of transactions rendered in html reports.

  """
  envReport = generateEnvironmentReport(app, profiles.transactionRepo, resultOrder, classifier,
      txnFilter, benchmarkPaths)
  categories = {name : Report.Category(name, histogram) for name, histogram in histograms.iteritems()}
  for profile in profiles:
    category = categories.get(profile.category, None)
    if category:
      begin = time.time()
      title = '{} latency statistics [{} transactions]'.format(profile.name, len(profile.current))
      LOGGER.info('generating report %s -> ', title)
      markup = ReportBuilder().buildReport(profile.current, profile.benchmarks, profile.reportProbes,
        profile.name, resultOrder, reportThreshold)
      markupSize = xpedite.util.formatHumanReadable(len(markup))
      title = '{} - ({})'.format(title, markupSize)
      description = '\n\t{}\n\t'.format(title)
      elapsed = time.time() - begin
      LOGGER.completed('completed %s in %0.2f sec.', markupSize, elapsed)
      category.addRoute(profile.name, title, description, markup)
  return Report(app, profiles, envReport, categories)
Esempio n. 2
0
def generate(profiles, histograms, resultOrder, reportThreshold):
  """
  Generates latency breakup reports for a list of profiles

  :param profiles: Profile data for the current profile session
  :param histograms: Latency distribuion histograms for each category/route combination
  :param resultOrder: Sort order of transactions in latency constituent reports
  :param reportThreshold: Threshold for number of transactions rendered in html reports.

  """
  from xpedite.report.reportbuilder    import ReportBuilder
  reports = {category : Report(category, histogram) for category, histogram in histograms.iteritems()}
  for profile in profiles:
    report = reports.get(profile.category, None)
    if report:
      begin = time.time()
      reportTitle = '{} latency statistics [{} transactions]'.format(profile.name, len(profile.current))
      LOGGER.info('generating report %s -> ', reportTitle)
      constituentReport = ReportBuilder().buildReport(profile.current, profile.benchmarks, profile.reportProbes
          , profile.name, resultOrder, reportThreshold)
      reportSize = xpedite.util.formatHumanReadable(len(constituentReport))
      reportTitle = '{} - ({})'.format(reportTitle, reportSize)
      description = '\n\t{}\n\t'.format(reportTitle)
      elapsed = time.time() - begin
      LOGGER.completed('completed %s in %0.2f sec.', reportSize, elapsed)
      report.addConstituent(profile.name, reportTitle, description, constituentReport)
  return reports.values()
Esempio n. 3
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 ''
Esempio n. 4
0
    def generateLatencyReports(self, profiles, flots, result, resultOrder,
                               reportThreshold):
        """
    Generates latency breakup reports for a list of profiles

    :param profiles: Profile data for the current profile session
    :param flots: Latency distribuion histograms for each category/route combination
    :param result: Handle to gather and store profiling results
    :param resultOrder: Sort order of transactions in latency constituent reports
    :param reportThreshold: Threshold for number of transactions rendered in html reports.

    """
        flotTracker = set()
        for profile in profiles:
            begin = time.time()
            reportTitle = '{} latency statistics [{} transactions]'.format(
                profile.name, len(profile.current))
            LOGGER.info('generating report %s -> ', reportTitle)

            category = profile.category
            if category not in flotTracker and category in flots:
                flots[category].attach(result)
                flotTracker.add(category)
            self.addTestResult(profile.name, result, profile.current,
                               profile.benchmarks)
            report = ReportBuilder().buildReport(profile.current,
                                                 profile.benchmarks,
                                                 profile.reportProbes,
                                                 profile.name, resultOrder,
                                                 reportThreshold)
            reportSize = formatHumanReadable(len(report))
            reportTitle = '{} - ({})'.format(reportTitle, reportSize)
            description = '\n\t{}\n\t'.format(reportTitle)
            elapsed = time.time() - begin
            LOGGER.completed('completed %s in %0.2f sec.', reportSize, elapsed)
            result.attachXpediteReport(profile.name, reportTitle, description,
                                       report)