2013-12-09 15:14:58 +08:00
|
|
|
import sys
|
2010-10-15 22:36:25 +08:00
|
|
|
|
2010-11-18 22:19:20 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import cProfile
|
2014-01-18 19:31:33 +08:00
|
|
|
import pytest
|
2010-11-18 22:19:20 +08:00
|
|
|
import pstats
|
2014-03-14 19:49:36 +08:00
|
|
|
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
|
|
|
|
stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof')
|
2010-11-18 22:19:20 +08:00
|
|
|
p = pstats.Stats("prof")
|
|
|
|
p.strip_dirs()
|
|
|
|
p.sort_stats('cumulative')
|
2014-10-06 19:37:57 +08:00
|
|
|
print(p.print_stats(500))
|