Python timing
This is a simple libraire to do fine timing of python application and measure parallelism
Install
pip
pip3 install git+https://gitlab.tetras-libre.fr/tetras-libre/performance-analysis/pyTiming#egg=pyTiming
For developpement
git clone https://gitlab.tetras-libre.fr/tetras-libre/performance-analysis/pyTiming
pip3 install -e .
As a dependency in your setup.py
from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools import setup, find_packages
import pip
...
gitDeps = [
'git+https://gitlab.tetras-libre.fr/tetras-libre/performance-analysis/pyTiming#egg=pyTiming',
]
def customRun(command_subclass):
orig_run = command_subclass.run
def modified_run(self):
for dep in gitDeps:
pip.main(['install', dep])
orig_run(self)
command_subclass.run = modified_run
return command_subclass
@customRun
class actionsOnInstall(install):
pass
@customRun
class actionsOnDevelop(develop):
pass
...
setup(
...
cmdclass={'install': actionsOnInstall,
'develop': actionsOnDevelop,
...
)
Usage
from pyTiming import pyTiming
timer = pyTiming.timer() # starts measuring time
. . .
timer.start_step('step1')
. . .
timer.start_step('step1.1')
. . .
timer.end_step('step1.1')
timer.start_step('step1.2')
. . .
timer.end_step('step1.2')
timer.end_step('step1')
timer.start_step('step2')
. . .
timer.end_step('step2')
timer.end() # end all measurements
print(timer.get_analysis())
Warning do not call a step 'main'
as this name is used for the global step