[Bf-blender-cvs] [e43ecca0162] master: Tests: measure time per frame in animation performance benchmark

Brecht Van Lommel noreply at git.blender.org
Mon Sep 20 19:07:36 CEST 2021


Commit: e43ecca01627393d0aabe56c2087d87938aed6c3
Author: Brecht Van Lommel
Date:   Mon Sep 20 18:44:52 2021 +0200
Branches: master
https://developer.blender.org/rBe43ecca01627393d0aabe56c2087d87938aed6c3

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.

===================================================================

M	tests/performance/tests/animation.py

===================================================================

diff --git a/tests/performance/tests/animation.py b/tests/performance/tests/animation.py
index 1a92f1a9718..c1a5c77860f 100644
--- a/tests/performance/tests/animation.py
+++ b/tests/performance/tests/animation.py
@@ -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]



More information about the Bf-blender-cvs mailing list