Commit 918738c9 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Add profiling option, to track where the time is spent.

parent df4e859d
......@@ -452,6 +452,24 @@ def main() -> None:
import pdb # pragma: no cover pylint: disable=wrong-import-position,wrong-import-order
pdb.set_trace() # pragma: no cover
if "-profile" in sys.argv:
sys.argv.remove("-profile")
import cProfile
import pstats
import io
pr = cProfile.Profile()
pr.enable()
import atexit
def dumpSpeedData():
pr.disable()
s = io.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
atexit.register(dumpSpeedData)
if "-v" in sys.argv:
import pkg_resources # pragma: no cover
version = pkg_resources.require("dmt")[0].version # pragma: no cover
......
......@@ -11,7 +11,7 @@ from setuptools import setup, find_packages
setup(
name='dmt',
version="2.1.31",
version="2.1.32",
packages=find_packages(),
author='Thanassis Tsiodras',
author_email='Thanassis.Tsiodras@esa.int',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment