Revision: 58791
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58791
Author:   nazgul
Date:     2013-07-31 21:55:54 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Made it so threaded update statistics only prints when something was updated

This prevents infinite prints of statistics while blender is idling.

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c

Modified: 
branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c     
2013-07-31 21:55:47 UTC (rev 58790)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c     
2013-07-31 21:55:54 UTC (rev 58791)
@@ -1179,6 +1179,7 @@
 
 #ifdef ENABLE_THREAD_STATISTICS
        ListBase statistics[64];
+       int num_updated_objects;
 #endif
 } ThreadedObjectUpdateState;
 
@@ -1186,7 +1187,8 @@
 
 static void scene_update_object_func(TaskPool *pool, void *taskdata, int 
threadid)
 {
-#define PRINT if (G.debug & G_DEBUG) printf
+/* Disable print for now in favor of summary statistics at the end of update. 
*/
+#define PRINT if (false) printf
 
        ThreadedObjectUpdateState *state = (ThreadedObjectUpdateState *) 
BLI_task_pool_userdata(pool);
        void *node = taskdata;
@@ -1204,6 +1206,12 @@
 #ifdef ENABLE_THREAD_STATISTICS
                if (G.debug & G_DEBUG) {
                        start_time = PIL_check_seconds_timer();
+
+                       if (object->recalc & OB_RECALC_ALL) {
+                               BLI_spin_lock(&state->lock);
+                               state->num_updated_objects++;
+                               BLI_spin_unlock(&state->lock);
+                       }
                }
 #endif
 
@@ -1257,21 +1265,24 @@
                double total_time = 0.0;
                StatisicsEntry *entry;
 
-               for (entry = state->statistics[i].first;
-                    entry;
-                    entry = entry->next)
-               {
-                       total_objects++;
-                       total_time += entry->time;
-               }
+               if (state->num_updated_objects > 0) {
+                       /* Don't pollute output if no objects were updated. */
+                       for (entry = state->statistics[i].first;
+                            entry;
+                            entry = entry->next)
+                       {
+                               total_objects++;
+                               total_time += entry->time;
+                       }
 
-               printf("Thread %d: total %d objects in %f sec.\n", i, 
total_objects, total_time);
+                       printf("Thread %d: total %d objects in %f sec.\n", i, 
total_objects, total_time);
 
-               for (entry = state->statistics[i].first;
-                    entry;
-                    entry = entry->next)
-               {
-                       printf("  %s in %f sec\n", entry->object->id.name + 2, 
entry->time);
+                       for (entry = state->statistics[i].first;
+                            entry;
+                            entry = entry->next)
+                               {
+                                       printf("  %s in %f sec\n", 
entry->object->id.name + 2, entry->time);
+                               }
                }
 
                BLI_freelistN(&state->statistics[i]);
@@ -1296,6 +1307,7 @@
        state.scene_parent = scene_parent;
 #ifdef ENABLE_THREAD_STATISTICS
        memset(state.statistics, 0, sizeof(state.statistics));
+       state.num_updated_objects = 0;
 #endif
        BLI_spin_init(&state.lock);
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to