From 3bae5244cf713581402aa2b929cdea782416d940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 9 Aug 2018 17:31:44 +0200 Subject: [PATCH] Change benchmark result 'stats' key to 'scenes' with different content Old: 'stats': [ {'scene_name': 'somescene', 'otherstat': 123} ] New: 'scenes': [ {'name': 'somescene', stats: {'otherstat': 123}} ] --- benchmark/space/__init__.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/benchmark/space/__init__.py b/benchmark/space/__init__.py index 5770929..e27f0d9 100644 --- a/benchmark/space/__init__.py +++ b/benchmark/space/__init__.py @@ -154,7 +154,8 @@ def benchmark_draw_post_pixel(arg1, arg2): y = 0.70 * window_height score = 0 - for stat in global_result_dict["stats"]: + for name_stats in global_result_dict["scenes"]: + stat = name_stats['stats'] if stat["result"] == "OK": score += stat["total_render_time"] else: @@ -283,7 +284,7 @@ class ProgressProviderSink: self.current_step = step_name self.current_progress = 0 progress_lock.release() - + def scene(self, scene_name): progress_lock.acquire() self.current_scene = scene_name @@ -375,8 +376,8 @@ def construct_platform_string(system_info): def convert_result_to_json_dict(ctx, results): # Convert custom classes to dictionaries for easier JSON dump. json_results = results - stats = json_results['stats'] - json_results['stats'] = [] + stats = json_results['scenes'] + json_results['scenes'] = [] for scene in ctx.scenes: if scene not in stats: continue @@ -386,8 +387,8 @@ def convert_result_to_json_dict(ctx, results): stat['result'] = 'OK' else: stat = {'result': 'CRASH'} - stat["scene_name"] = scene - json_results['stats'] .append(stat) + json_results['scenes'].append({'name': scene, + 'stats': stat}) return json_results @@ -462,7 +463,7 @@ def benchmark_thread(ctx): "blender_version": system_info.getBlenderVersion(ctx), "system_info": modify_system_info(blender_system_info), "device_info": modify_device_info(blender_device_info), - "stats": all_stats if all_stats else {} + "scenes": all_stats if all_stats else {} }) progress_lock.acquire() @@ -687,15 +688,16 @@ class BENCHMARK_OT_run_base(bpy.types.Operator): reset_global_state() else: global_result_stats = "" - for stat in global_result_dict["stats"]: + for name_stat in global_result_dict["scenes"]: + stat = name_stat["stats"] if global_result_stats: global_result_stats += "\n" if stat["result"] == "OK": - global_result_stats += "{}: {}" . format(stat["scene_name"], + global_result_stats += "{}: {}" . format(name_stat['name'], util.humanReadableTimeDifference( stat["total_render_time"])) else: - global_result_stats += "{}: {}" . format(stat["scene_name"], + global_result_stats += "{}: {}" . format(name_stat['name'], stat["result"]) # TOGO(sergey): Use some more nice picture for the final slide. global global_background_image_path