Cycles: Report system memory usage and peak after scene device update
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 14 Feb 2015 14:39:14 +0000 (19:39 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 14 Feb 2015 21:01:48 +0000 (02:01 +0500)
This only happens when built with WITH_CYCLES_DEBUG flag, memory statistics
is coming from guarded STL allocator.

intern/cycles/render/scene.cpp

index 64d6fa4b9b9f90bae51330a17c43a98eb36ee45e..524574f096dfdc652336394fb56d2871ca473d75 100644 (file)
 #include "util_foreach.h"
 #include "util_progress.h"
 
+#ifdef WITH_CYCLES_DEBUG
+#  include "util_guarded_allocator.h"
+#  include "util_logging.h"
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
@@ -239,6 +244,12 @@ void Scene::device_update(Device *device_, Progress& progress)
                progress.set_status("Updating Device", "Writing constant memory");
                device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
        }
+
+#ifdef WITH_CYCLES_DEBUG
+       VLOG(1) << "System memory statistics after full device sync:\n"
+               << "  Usage: " << util_guarded_get_mem_used() << "\n"
+               << "  Peak: " << util_guarded_get_mem_peak();
+#endif
 }
 
 Scene::MotionType Scene::need_motion(bool advanced_shading)