joerick/pyinstrument

Support `-c` input mode

hauntsaninja opened this issue · 1 comments

I often want to run pyinstrument on snippets, e.g. just an import or one function call. It would be nice if I could write pyinstrument -c "import slow_thing" to profile, instead of having to write a dummy file containing import slow_thing.

Good idea! It would help to see another module that supports this that I could crib some code from. I suppose timeit has something like this already.