From 4d37341655812192fa5da0c597f59986e2c8199e Mon Sep 17 00:00:00 2001 From: April Novak Date: Thu, 25 Jul 2024 11:43:00 -0500 Subject: [PATCH] Rename MAX_STACK_SIZE. Refs #28225 --- framework/doc/content/source/utils/PerfGraph.md | 2 +- framework/include/utils_nonunity/PerfGraph.h | 8 ++++---- framework/include/utils_nonunity/PerfGraphLivePrint.h | 2 +- framework/src/utils_nonunity/PerfGraph.C | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/framework/doc/content/source/utils/PerfGraph.md b/framework/doc/content/source/utils/PerfGraph.md index e09d6c18874c..99d7fc3e6023 100644 --- a/framework/doc/content/source/utils/PerfGraph.md +++ b/framework/doc/content/source/utils/PerfGraph.md @@ -161,7 +161,7 @@ An object that inherits from `PerfGraphInterface` can retrieve the data pertaini The `PerfGraph` object's main purpose is to store the complete call-graph of `PerfNode`s and the current call-stack of `PerfNode`s. The graph is held by holding onto the `_root_node`. All other scopes that are pushed into the graph are then children/descendants of the `_root_node`. -The call-stack is held within the `_stack` variable. The `_stack` is statically allocated to `MAX_STACK_SIZE` and `_current_position` is used to point at the most recent node on the stack. When a `PerfGuard` tells the `PerfStack` about a new scope, the new scope is added a child to the `PerfNode` that is in the `_current_position`. `_current_position` is then incremented and the new `PerfNode` is put there. When a scope is removed by the `PerfGuard` the `_current_position` is simply decremented - with no other action being necessary. +The call-stack is held within the `_stack` variable. The `_stack` is statically allocated to `MOOSE_MAX_STACK_SIZE` and `_current_position` is used to point at the most recent node on the stack. When a `PerfGuard` tells the `PerfStack` about a new scope, the new scope is added a child to the `PerfNode` that is in the `_current_position`. `_current_position` is then incremented and the new `PerfNode` is put there. When a scope is removed by the `PerfGuard` the `_current_position` is simply decremented - with no other action being necessary. In addition, the `_execution_list` is keeping a running list of every section that executes. This is utilized by `PerfGraphLivePrint` to print messages out that are multiple levels deep. diff --git a/framework/include/utils_nonunity/PerfGraph.h b/framework/include/utils_nonunity/PerfGraph.h index 01fb17fdfabc..9755626eaa93 100644 --- a/framework/include/utils_nonunity/PerfGraph.h +++ b/framework/include/utils_nonunity/PerfGraph.h @@ -33,7 +33,7 @@ class PerfGraphLivePrint; template class VariadicTable; -#define MAX_STACK_SIZE 100 +#define MOOSE_MAX_STACK_SIZE 100 #define MAX_EXECUTION_LIST_SIZE 10000 /** @@ -187,7 +187,7 @@ class PerfGraph : protected ConsoleStreamInterface template void treeRecurse(const Functor & act, - const unsigned int level = MAX_STACK_SIZE, + const unsigned int level = MOOSE_MAX_STACK_SIZE, const bool heaviest = false) const; protected: @@ -352,7 +352,7 @@ class PerfGraph : protected ConsoleStreamInterface int _current_position; /// The full callstack. Currently capped at a depth of 100 - std::array _stack; + std::array _stack; /// A circular buffer for holding the execution list, this is read by the printing loop std::array _execution_list; @@ -471,7 +471,7 @@ PerfGraph::treeRecurseInternal(const PerfNode & node, template void PerfGraph::treeRecurse(const Functor & act, - const unsigned int level /* = MAX_STACK_SIZE */, + const unsigned int level /* = MOOSE_MAX_STACK_SIZE */, const bool heaviest /* = false */) const { mooseAssert(_root_node, "Root node does not exist; calling this too early"); diff --git a/framework/include/utils_nonunity/PerfGraphLivePrint.h b/framework/include/utils_nonunity/PerfGraphLivePrint.h index c74aee1af34b..391bc74707a0 100644 --- a/framework/include/utils_nonunity/PerfGraphLivePrint.h +++ b/framework/include/utils_nonunity/PerfGraphLivePrint.h @@ -92,7 +92,7 @@ class PerfGraphLivePrint : protected ConsoleStreamInterface unsigned int _stack_level; /// The current stack for what the print thread has seen - std::array _print_thread_stack; + std::array _print_thread_stack; /// The end of the execution list /// This is (safely) copied from PerfGraph so that it is consistent for an diff --git a/framework/src/utils_nonunity/PerfGraph.C b/framework/src/utils_nonunity/PerfGraph.C index 7e995c48b99f..7375e5a8e5b6 100644 --- a/framework/src/utils_nonunity/PerfGraph.C +++ b/framework/src/utils_nonunity/PerfGraph.C @@ -215,7 +215,7 @@ PerfGraph::push(const PerfID id) _current_position++; - if (_current_position >= MAX_STACK_SIZE) + if (_current_position >= MOOSE_MAX_STACK_SIZE) mooseError("PerfGraph is out of stack space!"); _stack[_current_position] = new_node; @@ -412,7 +412,7 @@ void PerfGraph::printHeaviestBranch(const ConsoleStream & console) { console << "\nHeaviest Branch:\n"; - treeTable(MAX_STACK_SIZE, /* heaviest = */ true).print(console); + treeTable(MOOSE_MAX_STACK_SIZE, /* heaviest = */ true).print(console); } void