[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58794] branches/soc-2013-depsgraph_mt/ source/blender/blenkernel/intern/scene.c: Small optimization to previous change of statistics output
Sergey Sharybin
sergey.vfx at gmail.com
Wed Jul 31 23:56:11 CEST 2013
Revision: 58794
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58794
Author: nazgul
Date: 2013-07-31 21:56:11 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
Small optimization to previous change of statistics output
Use boolean flag for detecting whether there're updated
objects instead of doing real object counter (which required
spin lock).
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:56:06 UTC (rev 58793)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c 2013-07-31 21:56:11 UTC (rev 58794)
@@ -1175,7 +1175,7 @@
/* Execution statistics */
ListBase statistics[BLENDER_MAX_THREADS];
- int num_updated_objects;
+ bool has_updated_objects;
} ThreadedObjectUpdateState;
static void scene_update_object_add_task(void *node, void *user_data);
@@ -1200,9 +1200,7 @@
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);
+ state->has_updated_objects = true;
}
}
@@ -1225,7 +1223,7 @@
}
else {
PRINT("Threda %d: update node %s\n", threadid,
- DAG_threaded_update_get_node_name(node));
+ DAG_threaded_update_get_node_name(node));
}
BLI_spin_lock(&state->lock);
@@ -1258,7 +1256,7 @@
double total_time = 0.0;
StatisicsEntry *entry;
- if (state->num_updated_objects > 0) {
+ if (state->has_updated_objects) {
/* Don't pollute output if no objects were updated. */
for (entry = state->statistics[i].first;
entry;
@@ -1298,7 +1296,7 @@
state.scene = scene;
state.scene_parent = scene_parent;
memset(state.statistics, 0, sizeof(state.statistics));
- state.num_updated_objects = 0;
+ state.has_updated_objects = false;
BLI_spin_init(&state.lock);
task_pool = BLI_task_pool_create(task_scheduler, &state);
More information about the Bf-blender-cvs
mailing list