From cf7ffa8d6017b7de8329b915aca57a8938ed688f Mon Sep 17 00:00:00 2001 From: pullusb Date: Mon, 4 Nov 2024 12:26:29 +0100 Subject: [PATCH] When using repeated iterations, do not store first iteration Also set minimum iterations to 2 --- __init__.py | 2 +- modifier_profiling.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index c908758..4a6044c 100755 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ from . import modifier_profiling bl_info = { "name": "Profiling Buddy", "author": "Simon Thommes, Samuel Bernou", - "version": (0, 2), + "version": (0, 3), "blender": (3, 5, 0), "location": "Properties > Modifier > Profiling Buddy", "description": "Adds panels to profile execution times.", diff --git a/modifier_profiling.py b/modifier_profiling.py index 8b8c215..242e50e 100755 --- a/modifier_profiling.py +++ b/modifier_profiling.py @@ -182,12 +182,16 @@ class PB_OT_evalulate(Operator): ## gather a list of all evaluated sessions for mod_eval in ob_eval.modifiers: - if i == 0: - tmp_dic[mod_eval.name] = [] t = mod_eval.execution_time - # print(i, mod_eval.name, t) - # wm['mod_timer'][mod_eval.name] = t # keep last evaluated time + + if i == 0: + # Initialize modifier dict time list + tmp_dic[mod_eval.name] = [] + + ## Do not store first iteration, often less precise timing + continue + tmp_dic[mod_eval.name] += [t] wm.progress_update(i) @@ -213,7 +217,7 @@ class PB_OT_evalulate(Operator): class PB_PG_modifiers_profiler(PropertyGroup): evaluation_live : bpy.props.BoolProperty(name='Live Mode', default=True) - evaluations_count : bpy.props.IntProperty(name='Evaluations', default=5) + evaluations_count : bpy.props.IntProperty(name='Evaluations', default=5, min=2) progress : bpy.props.IntProperty(name='Progress', default=-1) # subprogress : bpy.props.IntProperty(name='ModifierProgress', default=-1) # use_frame_set : bpy.props.BoolProperty(name='Set Frame At Each Iteration', default=True)