[Bf-blender-cvs] [94109ede5ac] temp-geometry-nodes-timings: Fix review comments #350124

Erik noreply at git.blender.org
Thu Nov 18 17:55:14 CET 2021


Commit: 94109ede5acae96c7f1101c0d3e46389942b43eb
Author: Erik
Date:   Thu Nov 18 17:53:38 2021 +0100
Branches: temp-geometry-nodes-timings
https://developer.blender.org/rB94109ede5acae96c7f1101c0d3e46389942b43eb

Fix review comments #350124

===================================================================

M	source/blender/editors/space_node/node_draw.cc
M	source/blender/modifiers/intern/MOD_nodes_evaluator.cc

===================================================================

diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index b2f4d749a9b..318a3faacb3 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -1595,6 +1595,7 @@ static std::chrono::microseconds node_get_execution_time(const bNodeTree *ntree,
         [&](const geo_log::NodeLog &node_log) { exec_time += node_log.execution_time(); });
   }
   else if (node->type == NODE_FRAME) {
+    /* Could be cached in the future if this recursive code turns out to be slow. */
     LISTBASE_FOREACH (bNode *, tnode, &ntree->nodes) {
       if (tnode->parent != node) {
         continue;
@@ -1676,7 +1677,7 @@ static std::string node_get_execution_time_label(const SpaceNode *snode, const b
 
 struct NodeExtraInfoRow {
   std::string text;
-  std::string tooltip;
+  const char *tooltip;
   int icon;
 };
 
@@ -1691,7 +1692,7 @@ static Vector<NodeExtraInfoRow> node_get_extra_info(const SpaceNode *snode, cons
     row.text = node_get_execution_time_label(snode, node);
     row.tooltip = "Latest execution time. Shows total execution time for groups and frames";
     row.icon = ICON_PREVIEW_RANGE;
-    rows.append(row);
+    rows.append(std::move(row));
   }
   return rows;
 }
@@ -1699,7 +1700,7 @@ static Vector<NodeExtraInfoRow> node_get_extra_info(const SpaceNode *snode, cons
 static void node_draw_extra_info_row(const bNode *node,
                                      const rctf *rect,
                                      const int row,
-                                     NodeExtraInfoRow extra_info_row)
+                                     const NodeExtraInfoRow &extra_info_row)
 {
   uiBut *but_timing = uiDefBut(node->block,
                                UI_BTYPE_LABEL,
@@ -1729,7 +1730,7 @@ static void node_draw_extra_info_row(const bNode *node,
                                  0,
                                  0,
                                  0,
-                                 extra_info_row.tooltip.c_str());
+                                 extra_info_row.tooltip);
   UI_block_emboss_set(node->block, UI_EMBOSS);
   if (node->flag & NODE_MUTED) {
     UI_but_flag_enable(but_timing, UI_BUT_INACTIVE);
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 6cb9399afc7..55524f8c425 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -928,9 +928,10 @@ class GeometryNodesEvaluator {
       params.error_message_add(geo_log::NodeWarningType::Legacy,
                                TIP_("Legacy node will be removed before Blender 4.0"));
     }
-    std::chrono::steady_clock::time_point begin = std::chrono::high_resolution_clock::now();
+    using Clock = std::chrono::steady_clock;
+    Clock::time_point begin = Clock::now();
     bnode.typeinfo->geometry_node_execute(params);
-    std::chrono::steady_clock::time_point end = std::chrono::high_resolution_clock::now();
+    Clock::time_point end = Clock::now();
     std::chrono::microseconds duration = std::chrono::duration_cast<std::chrono::microseconds>(
         end - begin);
     params_.geo_logger->local().log_execution_time(node, duration);



More information about the Bf-blender-cvs mailing list