Tests: measure time per frame in animation performance benchmark

Instead of a fixed number of frames, so that benchmarking takes about the
same time on any machine.
This commit is contained in:
Brecht Van Lommel 2021-09-20 18:44:52 +02:00
parent 3b8d702a2f
commit e43ecca016
1 changed files with 13 additions and 7 deletions

View File

@ -9,14 +9,20 @@ def _run(args):
import time
start_time = time.time()
elapsed_time = 0.0
num_frames = 0
scene = bpy.context.scene
for i in range(scene.frame_start, scene.frame_end):
scene.frame_set(scene.frame_start)
while elapsed_time < 10.0:
scene = bpy.context.scene
for i in range(scene.frame_start, scene.frame_end + 1):
scene.frame_set(i)
elapsed_time = time.time() - start_time
num_frames += scene.frame_end + 1 - scene.frame_start
elapsed_time = time.time() - start_time
result = {'time': elapsed_time}
time_per_frame = elapsed_time / num_frames
result = {'time': time_per_frame}
return result
@ -32,10 +38,10 @@ class AnimationTest(api.Test):
def run(self, env, device_id):
args = {}
result, _ = env.run_in_blender(_run, args)
result, _ = env.run_in_blender(_run, args, [self.filepath])
return result
def generate(env):
filepaths = env.find_blend_files('animation')
filepaths = env.find_blend_files('animation/*')
return [AnimationTest(filepath) for filepath in filepaths]