I would like to profile a custom management command that is relatively CPU intensive (renders an image using PIL). When I use the following command I get all sorts of Django modules (admin, ORM etc) in my profiling results:
python -m cProfile manage.py testrender
I have removed all imports that can potentially import Django but I am guessing the following is the culprit:
from django.core.management.base import BaseCommand, CommandError
Is there a way to filter out cProfile
results? (only filenames are shown, no paths) Or, is there any other way to exclude/include respective modules/packages from profiling?