示例#1
0
    def enableProbes(self, probes):
        """
    Enables the list of given probes

    :param probes: List of probes to be enabled for the current profile session

    """
        from xpedite.profiler.probeAdmin import ProbeAdmin
        LOGGER.debug('Enabling probes %s', self.formatProbes(probes))
        if probes:
            if self.eventSet:
                errMsg = ProbeAdmin.enablePMU(self.app, self.eventSet)
                if errMsg:
                    msg = 'failed to enable PMU ({})'.format(errMsg)
                    LOGGER.error(msg)
                    raise Exception(msg)
            (errCount, errMsg) = ProbeAdmin.updateProbes(self.app,
                                                         probes,
                                                         targetState=True)
            if errCount > 0:
                msg = 'failed to enable probes ({} error(s))\n{}'.format(
                    errCount, errMsg)
                LOGGER.error(msg)
                raise Exception(msg)
        else:
            LOGGER.warn(
                'failed to enable probes - Invalid or empty probes argument')
示例#2
0
    def resolveAnchoredProbe(self, app, probe):
        """
    Resolves source location of the given probe

    :param app: Handle to the instance of the xpedite app
    :type app: xpedite.profiler.app.XpediteApp
    :param probe: handle to a probe for resolution of file name and line number
    :type probe: xpedite.types.probe.AnchoredProbe

    """
        if self.anchoredProbeMap is None:
            self.anchoredProbeMap = {}
            probes = ProbeAdmin.getProbes(app)
            for liveProbe in probes:
                if liveProbe.sysName:
                    if liveProbe.sysName in self.anchoredProbeMap:
                        self.anchoredProbeMap[liveProbe.sysName].append(
                            liveProbe)
                    else:
                        self.anchoredProbeMap.update(
                            {liveProbe.sysName: [liveProbe]})

        if self.anchoredProbeMap and probe.sysName in self.anchoredProbeMap:
            return self.anchoredProbeMap[probe.sysName]
        return None
示例#3
0
def _loadProbes(app):
  """Attaches to application and loads probe data"""
  from xpedite.profiler.probeAdmin import ProbeAdmin
  try:
    with app:
      pingApp(app)
      return ProbeAdmin.loadProbes(app)
  except Exception as _:
    return list(app.appInfo.probes.values())
示例#4
0
文件: profile.py 项目: xwlan/Xpedite
def loadProbes(binary,
               profileInfo,
               txnCount,
               threadCount,
               remote=None,
               workspace=None):
    """
  Generate a probe map to test the state of application probes
  """
    with TargetLauncher(binary, profileInfo, txnCount, threadCount, workspace,
                        remote) as app:
        return ProbeAdmin.loadProbes(app.xpediteApp)
示例#5
0
def test_generate_cmd_vs_baseline(scenarioName):
  """
  Test xpedite generate by generating a new profileInfo.py file and comparing to baseline
  profileInfo.py in the test data directory
  """
  from test_xpedite.test_profiler.app import TargetLauncher
  from xpedite.profiler.probeAdmin    import ProbeAdmin
  with SCENARIO_LOADER[scenarioName] as scenarios:
    with TargetLauncher(CONTEXT, scenarios) as app:
      probes = ProbeAdmin.loadProbes(app.xpediteApp)
      profileInfoFile = generateProfileInfoFile(app.xpediteApp, probes)
      generatedProfileInfo = loadProfileInfo('', profileInfoFile)
      (generatedProfileInfo.benchmarkPaths, generatedProfileInfo.cpuSet, generatedProfileInfo.pmc) = (None, None, None)
    findDiff(generatedProfileInfo.__dict__, scenarios.baselineProfileInfo.__dict__)
    assert generatedProfileInfo == scenarios.baselineProfileInfo
示例#6
0
def generateProfileInfo(binary, profileInfo, remote):
    """
  Use Xpedite's profile information generator to generate a new profileInfo.py
  file for an xpedite application and compare the new profile information to
  baseline profile information
  """
    from xpedite.profiler.profileInfoGenerator import ProfileInfoGenerator
    with TargetLauncher(binary, profileInfo, remote) as app:
        probes = ProbeAdmin.loadProbes(app.xpediteApp)
        profiler = os.path.join(os.path.dirname(testDir),
                                'scripts/bin/xpedite')
        profileInfo.appInfo = os.path.join(app.tempDir, 'xpedite-appinfo.txt')
        generator = ProfileInfoGenerator(app.xpediteApp.getBinaryName(),
                                         profileInfo.appHost,
                                         os.path.basename(profileInfo.appInfo),
                                         probes, profiler)
        generator.generate()
    return generator.filePath
示例#7
0
def loadProbes(context, scenario):
    """
  Generate a probe map to test the state of application probes
  """
    with TargetLauncher(context, scenario) as app:
        return ProbeAdmin.loadProbes(app.xpediteApp)
示例#8
0
def _loadProbes(app):
    """Attaches to application and loads probe data"""
    with app:
        pingApp(app)
        from xpedite.profiler.probeAdmin import ProbeAdmin
        return ProbeAdmin.loadProbes(app)