Plugin-Profiler | benchmark/debug your bpy work

Hello

I’m the author of a large multi-module plugin, in the quest of profiling my work, today I’ve made a standalone addon to help developers optimize/debug their plugins. (it can also work with the native blender python code).

The main features consist of:

  • An execution tracker, it will print every python function call in real time, you are able to filter the calls by modules/functions, & save these filters as presets when swapping from one project to another
    fdgfddfg

  • A benchmark tool, that will record and then generate statistics of the session function calls, it is linked to snakeviz analytic app, you will need to pip install snakeviz on your console first in order to visualize the graph. This is the kind of graph it can produce.

Notes:

  • linux is not supported for the snakeviz subprocess.PopOpen() command call, a little help is welcome in that area
  • There might be a crash related to a blender bug with the export log operator. somehow this operator is incapable of running fileselect_add() (maybe just related to my computer?to confirm).
  • If you have ideas on tools we could add to this toolset don’t hesitate to comment :slight_smile:

Cheers

17 Likes

Amazing work. And here I was using cProfile like a dingus.

1 Like

Holy snakes of the Python god! :star_struck:

Well at least you weren’t printing comments everywhere like a bigus dingus (totally not me).

2 Likes

Thanks everyone :slight_smile:

Except for this tool, was there any alternative in the past?
Not sure how we could use debugging tools of our IDE’s with blender plugin

I tried installing the plugin profiler today, but where am I supposed to find it after that? :o

For debugging python, I’ve always used Blender Development - Visual Studio Marketplace with VSCode. It allows you to put breakpoints both in the addon as well as blender core (or even both if you attach a debugger to the running blender instance).

2 Likes

In the addon preferences, search for “Plugin-Profiler”

All I can see is this:

I don’t know where to go from there, I don’t see the same thing as in your screenshots and there is no indication as to where to find stuff :frowning:

No idea, so far I either used Blender’s text Editor, Sublime Text or VSE with Jacques Lucke’s Blender Development package.

Somehow I enjoy it more on Sublime Text, once I did my addon build environment.

BTW, if you are looking for ideas of tools and things to enhance developers’ life inside Blender, maybe this topic can be a nice thing to look at:

That’s where I found some nice gems like this one blender-scripts/code_editor.py at master · K-410/blender-scripts · GitHub

People also share the addons/scripts they made for developers here, so feel free to post Plugin-Profiler there!

Damn github :melting_face:
it added a -main in the plugin name
not sure how i can avoid this behavior
rename the folder to Plugin-Profiler please

Oooooh I see what happened there :smiley:

That’s why I always make releases on github, to keep full controll of the files I get in and their names. Plus It allows me to not include github specific stuff that’s useless to the addons itself, and also make quick release notes on github thanks to release tags :heart:


I played with it a bit, it 's so cool to see a console actually alive!

I was wondering it it would be possible to have a place to make it listen to text blocs in the .blend file?

Thanks for this tool at least!

1 Like

hey, does this write to a log file in real-time so that function calls prior to a blender hard crash can be investigated? I have an issue at the moment where an access violation happens, but only when not launching Blender from VS Code, so I can’t debug it without manually writing to a file at various function calls to try and track it down.

No but you could implement it :slight_smile:

2 Likes

if you do a release it will create a zip that doesn’t have messed up filenames.

Running it on win 10, trying to save the log crashes blender, trying to open snakeviz throws a permissions error inside the preferences that cant be dismissed. Being able to set the path to have the log saved to would be good as its putting it in the app folder which by default is write protected.

Great help once I got that sorted though, thanks.