vpelletier / pprofile

Line-granularity, thread-aware deterministic and statistic pure-python profiler
GNU General Public License v2.0
447 stars 28 forks source link

Can I ignore certain modules on the output? #28

Closed rafaellehmkuhl closed 4 years ago

rafaellehmkuhl commented 6 years ago

On my software I have several modules that I built myself, and so I want to profile them, but I also use some standard modules (like serial, json, os, etc) that I don't want to profile. Those std modules make the output enormous and difficult to analyze. Is there a way to remove them from the output?

vpelletier commented 6 years ago

If you are running pprofile as a command, you will want to check --exclude & --include options (see pprofile --help).

If you are using pprofile as a module, you can pass a list of modules "filenames" (module.__file__) to the filename argument of annotate or callgrind method (depending on the output format you need). You can build such list by filtering the list of modules pprofile discovered during profiling (IOW, those which were executed during profiling) by calling getFilenameSet.