Esempio n. 1
0
 def test_is_pypyjit_available(self):
     try:
         import pypyjit
         snp=pypyjit.get_stats_snapshot()
         print u"pypyjit.get_stats_snapshot().counter_times: {}".format(snp.counter_times)
     except ImportError:
         self.assertEqual(True, False, "pypyjit is not available")
Esempio n. 2
0
    def test_get_stats_snapshot(self):
        skip("a bit no idea how to test it")
        from pypyjit import get_stats_snapshot

        stats = get_stats_snapshot()  # we can't do much here, unfortunately
        assert stats.w_loop_run_times == []
        assert isinstance(stats.w_counters, dict)
        assert sorted(stats.w_counters.keys()) == self.sorted_keys
Esempio n. 3
0
    def test_get_stats_snapshot(self):
        skip("a bit no idea how to test it")
        from pypyjit import get_stats_snapshot

        stats = get_stats_snapshot() # we can't do much here, unfortunately
        assert stats.w_loop_run_times == []
        assert isinstance(stats.w_counters, dict)
        assert sorted(stats.w_counters.keys()) == self.sorted_keys
Esempio n. 4
0
    krun_init()
    num_cores = krun_get_num_cores()

    # Pre-allocate result lists
    wallclock_times = array.array("d", [0.0] * iters)
    # Although we can't be sure what size "L" actually is, if we generate ints
    # it can't store, an OverflowError results, so there's no chance of silent
    # truncation.
    cycle_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]
    aperf_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]
    mperf_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]

    # Main loop
    for i in xrange(iters):
        if instrument:
            start_snap = pypyjit.get_stats_snapshot()
        if debug:
            sys.stderr.write("[iterations_runner.py] iteration %d/%d\n" %
                             (i + 1, iters))

        # Start timed section
        krun_measure(0)
        bench_func(param)
        krun_measure(1)
        # End timed section

        # Extract/check/store wallclock time
        wallclock_times[i] = krun_get_wallclock(1) - krun_get_wallclock(0)

        # Extract/check/store per-core data
        for core in xrange(num_cores):
Esempio n. 5
0
    krun_init()
    num_cores = krun_get_num_cores()

    # Pre-allocate result lists
    wallclock_times = array.array("d", [-0.0] * iters)
    # Although we can't be sure what size "L" actually is, if we generate ints
    # it can't store, an OverflowError results, so there's no chance of silent
    # truncation.
    cycle_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]
    aperf_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]
    mperf_counts = [array.array("L", [0] * iters) for _ in range(num_cores)]

    # Main loop
    for i in xrange(iters):
        if instrument:
            start_snap = pypyjit.get_stats_snapshot()
        if debug:
            sys.stderr.write(
                "[iterations_runner.py] iteration %d/%d\n" % (i + 1, iters))

        # Start timed section
        krun_measure(0)
        bench_func(param)
        krun_measure(1)
        # End timed section

        # Extract/check/store wallclock time
        wallclock_times[i] = krun_get_wallclock(1) - krun_get_wallclock(0)

        # Extract/check/store per-core data
        for core in xrange(num_cores):