nvdv / vprof

Visual profiler for Python
BSD 2-Clause "Simplified" License
3.95k stars 154 forks source link

Add suport for profiling a script that has its own arguments #55

Closed durden closed 8 years ago

durden commented 8 years ago

This is a trick similar to what the default cProfile module does to allow profiling of scripts that have their own arguments.

durden commented 8 years ago

It might also be worth mentioning in the docs that this doesn't support the script being profiled from having duplicate arguments to vprof. Not sure what the best workaround is there. I looked around to see what cProfile did, but I didn't find anything useful.

nvdv commented 8 years ago

Hi, vprof supports profiling scripts with their own arguments, you just need to use double quotes: vprof -c cmh -s "testscript.py --foo --bar". sys.args manipulation is done here: https://github.com/nvdv/vprof/blob/master/vprof/base_profile.py#L72

durden commented 8 years ago

Oh ok, thanks for the clarification. I guess my change doesn't require double quotes, but double quotes is easy to add so no worries. I clearly see how this is specified in the README now, sorry I missed it!

nvdv commented 8 years ago

Sure 😄

nvdv commented 8 years ago

Since the issue is resolved, I am closing this PR. Thanks!