Exemplo n.º 1
0
  def filterTimelineStats(self, tls):
    """
    Filters timelines from a timeline statistics object

    :param tls: timeline statistics object to be filtered

    """
    from xpedite.analytics.conflator import Conflator
    filteredTls = Conflator.createTimelineStats(tls, tls.category, tls.route)
    filteredTls.timelineCollection = self.filterTimelines(tls.timelineCollection)
    Conflator.buildDeltaSeriesRepo(filteredTls)
    return filteredTls
Exemplo n.º 2
0
def diffTxn(lhs, rhs, profiles):
    """
  Compares duration/pmc values for a pair of transactions

  :param lhs: Transaction id (lhs value of comparison)
  :type lhs: int
  :param rhs: Transaction id (rhs value of comparison)
  :type rhs: int
  :param profiles: Transactions from the current profile session
  :type profiles: xpedite.report.profile.Profiles

  """
    from xpedite.analytics.timelineFilter import locateTimeline
    from xpedite.report.diff import DiffBuilder
    from xpedite.route import conflateRoutes
    from xpedite.analytics.conflator import Conflator

    timeline1 = locateTimeline(profiles, lhs)
    timeline2 = locateTimeline(profiles, rhs)
    if timeline1 and timeline2:
        lhs, rhs = (timeline1,
                    timeline2) if len(timeline1) > len(timeline2) else (
                        timeline2, timeline1)
        routeIndices = conflateRoutes(lhs.txn.route, rhs.txn.route)
        if not routeIndices:
            display(
                HTML(
                    ERROR_TEXT.format(
                        'Transactions {} and {} are not comparable'.format(
                            lhs.txnId, rhs.txnId))))
            return
        topdownMetrics = Conflator().getTopdownMetrics(profiles.cpuInfo.cpuId,
                                                       profiles.topdownKeys)
        conflatedTimeline = Conflator().conflateTimeline(
            lhs, routeIndices, profiles.eventsMap, topdownMetrics)
        display(HTML(str(DiffBuilder().buildDiffTable(conflatedTimeline,
                                                      rhs))))
    else:
        if not (timeline1 or timeline2):
            display(
                HTML(
                    ERROR_TEXT.format(
                        'Can\'t find transactions. Are these ({} and {}) valid txn id\'s?'
                        .format(lhs, rhs))))
        else:
            txnId = rhs if timeline1 else lhs
            display(
                HTML(
                    ERROR_TEXT.format(
                        'Can\'t find transaction {}, is the txn id valid?'.
                        format(txnId))))
Exemplo n.º 3
0
 def __init__(self):
     from xpedite.analytics.conflator import Conflator
     self.conflator = Conflator()
     self._profiles = None
     self.profileState = None
     self.txn = None
     self.executor = futures.ThreadPoolExecutor(max_workers=1)
     self.dataFile = None
Exemplo n.º 4
0
def diffTxns(lhs, rhs, profiles):
    """
  Compares statistics for a group of transactions

  :param lhs: A list of transaction ids (lhs value of comparison)
  :param rhs: A list of transaction ids (rhs value of comparison)
  :param profiles: Transactions from the current profile session
  :type profiles: xpedite.report.profile.Profiles

  """
    from xpedite.analytics.timelineFilter import locateTimeline
    from xpedite.analytics.conflator import Conflator
    from xpedite.report.stats import StatsBuilder

    lhs = [lhs] if not isinstance(lhs, list) else lhs
    rhs = [rhs] if not isinstance(rhs, list) else rhs
    if not all(isinstance(txn, int)
               for txn in lhs) or not all(isinstance(txn, int) for txn in rhs):
        display(
            HTML(
                ERROR_TEXT.format(
                    'Arguments must contain only valid txn ids (integers), example - diff([1, 2, 3, ... ], 1000)'
                )))
        return
    try:
        _ = [locateTimeline(profiles, timeline).txn for timeline in lhs]
        _ = [locateTimeline(profiles, timeline).txn for timeline in rhs]
    except Exception:
        display(
            HTML(
                ERROR_TEXT.format(
                    'Can\'t locate one or more transactions, Are these valid txn id\'s?'
                )))
        return

    lhsProfiles = filter(lambda txn: txn.txnId in lhs)
    rhsProfiles = filter(lambda txn: txn.txnId in rhs)

    for i, profile in enumerate(lhsProfiles.profiles):
        category = 'Route #{}'.format(i)
        rhsProfile = Conflator().conflateProfiles(rhsProfiles.profiles,
                                                  profile.route, category)
        if rhsProfile and len(rhsProfile.current) == 1 and len(
                profile.current) == 1:
            diffTxn(profile.current[0].txnId, rhsProfile.current[0].txnId,
                    profiles)
        elif rhsProfile and rhsProfile.current:
            display(
                HTML(
                    str(StatsBuilder().buildStatsTable(
                        category, profile.current,
                        {category: rhsProfile.current}))))
        else:
            display(
                HTML(
                    ERROR_TEXT.format(
                        'route {} with {} txns occurs only in one side of equality'
                        .format(profile.route, rhs.current))))
Exemplo n.º 5
0
 def __init__(self):
     from xpedite.analytics.conflator import Conflator
     self.conflator = Conflator()
     self._profiles = None
     self.profileState = None
     self.txn = None
     #pylint: disable=consider-using-with
     self.executor = futures.ThreadPoolExecutor(max_workers=1)
     self.dataFile = None
     self.errMsg = None