summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/pytest/bench/bench.py
blob: ce94964172f0db353a629db5cab45831ee4c19d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import sys

if __name__ == '__main__':
    import cProfile
    import pytest
    import pstats
    script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
    stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof')
    p = pstats.Stats("prof")
    p.strip_dirs()
    p.sort_stats('cumulative')
    print(p.print_stats(500))