Beispiel #1
0
def test_record_vs_report(capsys, scenarioName):
  """
  Run xpedite record and xpedite report to compare profiles
  """
  checkPmcSupport(scenarioName)
  with SCENARIO_LOADER[scenarioName] as scenarios:
    with capsys.disabled():
      currentReport, _, _ = runXpediteRecord(CONTEXT, scenarios)
    report = runXpediteReport(currentReport.runId, CONTEXT, scenarios)
    findDiff(report.profiles.__dict__, currentReport.profiles.__dict__)
    assert report.profiles == currentReport.profiles
Beispiel #2
0
def test_intercept(capsys):
    """
  Run and test intercept functionality with a target doing memory allocations

  @param capsys: A pytest fixture allowing disabling of I/O capturing
  """
    for scenarios in SCENARIO_LOADER:
        with scenarios as scenarios:
            with capsys.disabled():
                report, _, _ = runXpediteRecord(CONTEXT, scenarios)
                profiles = report.profiles
                assert len(profiles) == 1
                timelines = profiles[0].current.timelineCollection
                assert len(timelines) == int(CONTEXT.txnCount)
                for tl in timelines:
                    assert tl.txn is not None
                    for probe in scenarios.probes:
                        assert tl.txn.hasProbe(probe)
Beispiel #3
0
def test_record_against_report(capsys, profileInfoPath=None):
    """
  Run xpedite record and xpedite report to compare profiles

  @param capsys: A pytest fixture allowing disabling of I/O capturing
  @param profileInfoPath: Override default profileInfo.py file from the test data directory
  """
    from test_xpedite.test_profiler.comparator import findDiff
    profileInfoPath = profileInfoPath if profileInfoPath else 'profileInfo.py'
    profileInfo = loadProfileInfo(profileInfoPath, remote)
    with capsys.disabled():
        app, recordProfiles, _ = runXpediteRecord(DEMO_BINARY, profileInfo,
                                                  remote)
    profileInfo = loadProfileInfo(profileInfoPath, remote)
    profileInfo.appInfo = os.path.join(app.tempDir, 'xpedite-appinfo.txt')
    reportProfiles, _ = runXpediteReport(app.xpediteApp.runId, profileInfo)
    findDiff(reportProfiles.__dict__, recordProfiles.__dict__)
    assert recordProfiles == reportProfiles
Beispiel #4
0
def test_intercept(capsys):
    """
  Run and test intercept functionality with a target doing memory allocations

  @param capsys: A pytest fixture allowing disabling of I/O capturing
  """
    from xpedite import Probe
    profileInfo = loadProfileInfo('allocatorProfileInfo.py', remote)
    with capsys.disabled():
        app, profiles, _ = runXpediteRecord(ALLOCATOR_BINARY, profileInfo,
                                            remote)
    assert len(profiles) == 1
    timelines = profiles[0].current.timelineCollection
    assert len(timelines) == 100
    for tl in timelines:
        assert tl.txn is not None
        for probe in profileInfo.probes:
            assert tl.txn.hasProbe(probe)
Beispiel #5
0
def test_intercept(capsys):
    """
  Run and test intercept functionality with a target doing memory allocations

  @param capsys: A pytest fixture allowing disabling of I/O capturing
  """
    from xpedite import Probe
    dataDir = os.path.join(os.path.dirname(__file__), '..', 'data')
    profileInfo = loadProfileInfo(dataDir, 'allocatorProfileInfo.py', REMOTE)
    with capsys.disabled():
        _, result = runXpediteRecord(ALLOCATOR_BINARY, profileInfo, TXN_COUNT,
                                     THREAD_COUNT, REMOTE)
    profiles = result.profiles
    assert len(profiles) == 1
    timelines = profiles[0].current.timelineCollection
    assert len(timelines) == int(TXN_COUNT)
    for tl in timelines:
        assert tl.txn is not None
        for probe in profileInfo.probes:
            assert tl.txn.hasProbe(probe)
Beispiel #6
0
def test_record_against_report(capsys, profileInfoPath=None):
    """
  Run xpedite record and xpedite report to compare profiles

  @param capsys: A pytest fixture allowing disabling of I/O capturing
  @param profileInfoPath: Override default profileInfo.py file from the test data directory
  """
    profileInfoPath = profileInfoPath if profileInfoPath else 'profileInfo.py'
    profileInfo = loadProfileInfo(DATA_DIR, profileInfoPath, REMOTE)
    with capsys.disabled():
        app, result = runXpediteRecord(FIX_DECODER_BINARY, profileInfo,
                                       TXN_COUNT, THREAD_COUNT, REMOTE,
                                       WORKSPACE)
    recordProfiles = result.profiles
    profileInfo = loadProfileInfo(DATA_DIR, profileInfoPath, REMOTE)
    profileInfo.appInfo = os.path.join(app.tempDir, 'xpedite-appinfo.txt')
    result = runXpediteReport(app.xpediteApp.runId,
                              profileInfo,
                              workspace=WORKSPACE)
    reportProfiles = result.profiles
    findDiff(reportProfiles.__dict__, recordProfiles.__dict__)
    assert reportProfiles == recordProfiles