Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-09-20 19:44:52 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-09-20 20:03:22 +0300
commite43ecca01627393d0aabe56c2087d87938aed6c3 (patch)
treed08e36c93ae552fd99bc9ada6beaa2c73fc8c855
parent3b8d702a2f071319d53aa622ebed0e9bc4ff3876 (diff)
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.
-rw-r--r--tests/performance/tests/animation.py20
1 files changed, 13 insertions, 7 deletions
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]