Commit: b02635ae1b5c582a213ad2ba6ff772f480dd831b Author: Jacques Lucke Date: Tue Apr 27 19:56:12 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBb02635ae1b5c582a213ad2ba6ff772f480dd831b
fix =================================================================== M source/blender/blenlib/BLI_profile.h M source/blender/blenlib/intern/profile.cc M source/blender/depsgraph/intern/eval/deg_eval.cc =================================================================== diff --git a/source/blender/blenlib/BLI_profile.h b/source/blender/blenlib/BLI_profile.h index 595cd7e122b..f1cbac7b3f7 100644 --- a/source/blender/blenlib/BLI_profile.h +++ b/source/blender/blenlib/BLI_profile.h @@ -60,7 +60,7 @@ void _bli_profile_task_end(BLI_ProfileTask *task); ((void)0) #define BLI_profile_task_end(task_ptr) \ - if (bli_profiling_is_enabled && (task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ + if ((task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ _bli_profile_task_end(task_ptr); \ } \ ((void)0) diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index ac427ac3708..50c5e61306c 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -60,7 +60,7 @@ struct ThreadLocalProfileData { RawStack<uint64_t> id_stack; }; -static ThreadLocalProfileData threadlocal_profile_data; +static thread_local ThreadLocalProfileData threadlocal_profile_data; bool bli_profiling_is_enabled = false; namespace blender::profile { @@ -140,7 +140,7 @@ void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, ThreadLocalProfileData &local_data = threadlocal_profile_data; const uint64_t id = get_unique_session_id(); - const uint64_t parent_id = local_data.id_stack.peek_default(0); + const uint64_t parent_id = parent_task->id; local_data.id_stack.push(id); task->id = id; diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 620e86550cc..2b6727c67c1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -29,6 +29,7 @@ #include "BLI_compiler_attrs.h" #include "BLI_gsqueue.h" +#include "BLI_profile.hh" #include "BLI_task.h" #include "BLI_utildefines.h" @@ -95,10 +96,13 @@ struct DepsgraphEvalState { bool do_stats; EvaluationStage stage; bool need_single_thread_pass; + BLI_ProfileTask profile_task; }; void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_node) { + BLI_PROFILE_SCOPE_SUBTASK(__func__, &state->profile_task); + ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph *>(state->graph); /* Sanity checks. */ @@ -379,6 +383,9 @@ void deg_evaluate_on_refresh(Depsgraph *graph) state.graph = graph; state.do_stats = graph->debug.do_time_debug(); state.need_single_thread_pass = false; + + BLI_profile_task_begin(&state.profile_task, __func__); + /* Prepare all nodes for evaluation. */ initialize_execution(&state, graph); @@ -413,6 +420,8 @@ void deg_evaluate_on_refresh(Depsgraph *graph) graph->is_evaluating = false; graph->debug.end_graph_evaluation(); + + BLI_profile_task_end(&state.profile_task); } } // namespace blender::deg _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs