mercurial/pure/__init__.py
author |
Gregory Szorc <gregory.szorc@gmail.com> |
|
Sun, 14 Aug 2016 16:30:44 -0700 |
changeset 29781 |
2654a0aac80d |
parent 16438 |
28a90cdf0ca0
|
permissions |
-rw-r--r-- |
profiling: move profiling code from dispatch.py (API)
Currently, profiling code lives in dispatch.py, which is a low-level
module centered around command dispatch. Furthermore, dispatch.py
imports a lot of other modules, meaning that importing dispatch.py
to get at profiling functionality would often result in a module import
cycle.
Profiling is a generic activity. It shouldn't be limited to command
dispatch. This patch moves profiling code from dispatch.py to the
new profiling.py. The low-level "run a profiler against a function"
functions have been moved verbatim. The code for determining how to
invoke the profiler has been extracted to its own function.
I decided to create a new module rather than stick this code
elsewhere (such as util.py) because util.py is already quite large.
And, I foresee this file growing larger once Facebook's profiling
enhancements get added to it.