From edd1164575feefda103c73119a98cbd994e53141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Thu, 1 Oct 2020 23:16:01 +0200 Subject: Cycles: add time statistics to scene update Gathers information for time spent in the various managers or object (Film, Camera, etc.) being updated in Scene::device_update. The stats include the total time spent in the device_update methods as well as time spent in subroutines (e.g. bvh build, displacement, etc.). This does not qualify as a full blown profiler, but is useful to identify potential bottleneck areas. The stats can be enabled and printed by passing `--cycles-print-stats` on the command line to Cycles, or `-- --cycles-print-stats` to Blender. Reviewed By: brecht Maniphest Tasks: T79174 Differential Revision: https://developer.blender.org/D8596 --- intern/cycles/render/light.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'intern/cycles/render/light.cpp') diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 5f586f98b13..100530ffba6 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -25,6 +25,7 @@ #include "render/object.h" #include "render/scene.h" #include "render/shader.h" +#include "render/stats.h" #include "util/util_foreach.h" #include "util/util_hash.h" @@ -961,6 +962,12 @@ void LightManager::device_update(Device *device, if (!need_update) return; + scoped_callback_timer timer([scene](double time) { + if (scene->update_stats) { + scene->update_stats->light.times.add_entry({"device_update", time}); + } + }); + VLOG(1) << "Total " << scene->lights.size() << " lights."; /* Detect which lights are enabled, also determins if we need to update the background. */ -- cgit v1.2.3