Blender Benchmark Code?

Hi there, I need to run Blender Benchmark headlessly, without a UI. I guess this isn’t possible right now, but if the source was available maybe it can be changed to do so. Is the source for it open? Where can I browse that source?

It’s here in the benchmark branch:
https://developer.blender.org/diffusion/B/history/benchmark/

Thank you for this! Do you perchance know where it calls the blender executable for the timing work? I should clarify, I meant the code for the blender-benchmark executable (on windows this is blender-benchmark.exe).

EDIT: Okay, I can find the source online, but is there a reason I can’t clone the benchmarks directory when I’m following the instructions to clone that repo? The instructions here I mean:

https://developer.blender.org/diffusion/B/repository/benchmark/

This is all in the main Blender git repository. You’re looking at a branch, so once you’ve cloned Blender source code as normal you check out the branch:

git checkout benchmark

The benchmark is really just Blender where the blender.exe is renamed to blender-benchmark.exe (see this commit).

I guess I’m a little confused, then. Looking at the install, it looks like blender-benchmark calls blender via a script called benchrunner.py, yes? Also, it looks like the command line flags that work with blender don’t work with blender-benchmark. How is that possible if it’s the same executable?

Digging in a little more, there’s a ‘main.py’ which seems to do the main (heh) work, I think. Is that right? I feel like I’m running in circles at the moment :frowning:

I think @sergey and @brecht have a better overview of how this works.

But my guess is that you’ll have to re-enable the command-line parsing to be able to properly use the benchmark in a headless configuration.

I think you may be right, but my worry is that it seems to run a script that then calls blender proper. If you look at the ‘benchrunner.py’ file, it builds a blender command line and everything. The missing piece for me is the ‘args’ that main(…) gets called with, which I can’t seem to even print out. I think I 'm missing something though, so I’ll keep looking. I’ve just been looking at the scripts that get installed with the benchmark package when this gets installed.

One last question, sorry, where can I see what “Quick Benchmark” and “Complete Benchmark” are running? I can see where those buttons are being constructed in the UI, but I don’t see what gets run when a user clicks on them, help?

If I read the code correctly:

  • regular blender executable is supposed to be bundled with the benchmark
  • look for method blender_executable_get
  • look at BENCHMARK_OT_run_base
    • see its invoke-method
    • this base class is used by the quick and complete commands.

Thank you kind sir, I shall take a look at that.