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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2020-10-02 00:16:01 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2020-10-02 00:21:11 +0300
commitedd1164575feefda103c73119a98cbd994e53141 (patch)
treeae69e078944ba7f27ffbce6209e4eef6e17fca88 /intern/cycles/render/camera.cpp
parent342bdbc1769fa31c734d7c38ab67be3428c9d234 (diff)
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
Diffstat (limited to 'intern/cycles/render/camera.cpp')
-rw-r--r--intern/cycles/render/camera.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 0fa1d512547..ee68c9ede22 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -18,6 +18,7 @@
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
+#include "render/stats.h"
#include "render/tables.h"
#include "device/device.h"
@@ -27,6 +28,7 @@
#include "util/util_logging.h"
#include "util/util_math_cdf.h"
#include "util/util_task.h"
+#include "util/util_time.h"
#include "util/util_vector.h"
/* needed for calculating differentials */
@@ -231,6 +233,12 @@ void Camera::update(Scene *scene)
if (!need_update)
return;
+ scoped_callback_timer timer([scene](double time) {
+ if (scene->update_stats) {
+ scene->update_stats->camera.times.add_entry({"update", time});
+ }
+ });
+
/* Full viewport to camera border in the viewport. */
Transform fulltoborder = transform_from_viewplane(viewport_camera_border);
Transform bordertofull = transform_inverse(fulltoborder);
@@ -466,6 +474,12 @@ void Camera::device_update(Device * /* device */, DeviceScene *dscene, Scene *sc
if (!need_device_update)
return;
+ scoped_callback_timer timer([scene](double time) {
+ if (scene->update_stats) {
+ scene->update_stats->camera.times.add_entry({"device_update", time});
+ }
+ });
+
scene->lookup_tables->remove_table(&shutter_table_offset);
if (kernel_camera.shuttertime != -1.0f) {
vector<float> shutter_table;