Depsgraph: Report graph construction time when run with --debug-depsgraph-build
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 22 Feb 2018 09:35:04 +0000 (10:35 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 22 Feb 2018 09:35:04 +0000 (10:35 +0100)
source/blender/depsgraph/intern/depsgraph_build.cc

index a04e59160c87c525a0f72e4106ca63ccca6b7a0c..1b270e71d64bc029b017382c3dadfca51dbc1d1f 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-// #define DEBUG_TIME
-
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
-#ifdef DEBUG_TIME
-#  include "PIL_time.h"
-#  include "PIL_time_utildefines.h"
-#endif
+#include "PIL_time.h"
+#include "PIL_time_utildefines.h"
 
 extern "C" {
 #include "DNA_cachefile_types.h"
@@ -200,9 +196,10 @@ void DEG_add_special_eval_flag(Depsgraph *graph, ID *id, short flag)
  */
 void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
 {
-#ifdef DEBUG_TIME
-       TIMEIT_START(DEG_graph_build_from_scene);
-#endif
+       double start_time;
+       if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+               start_time = PIL_check_seconds_timer();
+       }
 
        DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
 
@@ -240,9 +237,10 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
        }
 #endif
 
-#ifdef DEBUG_TIME
-       TIMEIT_END(DEG_graph_build_from_scene);
-#endif
+       if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+               printf("Depsgraph built in %f seconds.\n",
+                      PIL_check_seconds_timer() - start_time);
+       }
 }
 
 /* Tag graph relations for update. */