pythonprofilers / memory_profiler

Monitor Memory usage of Python code
http://pypi.python.org/pypi/memory_profiler
Other
4.39k stars 380 forks source link

Running mprof with python -m #343

Open JPFrancoia opened 2 years ago

JPFrancoia commented 2 years ago

Hello,

Most of the time I run my Python softwares like this: python -m package.module.module. This is generally better than doing python path/path/script.py, because imports are resolved properly.

I can use this and still profile with mprof: mprof run python -m package.module.module. This works well, but if I want timestamps for functions to be recorded, it doesn't work, i.e: if I remove from memory_profile import profile from my code, I get an import error when I use the @profile decorator.

I've read the doc and searched the issues but I couldn't find a solution. Could you help me please?