diff --git a/test/include/problems/SlowProblem.h b/test/include/problems/SlowProblem.h index b48639899ce7..4b5f46493e80 100644 --- a/test/include/problems/SlowProblem.h +++ b/test/include/problems/SlowProblem.h @@ -30,5 +30,6 @@ class SlowProblem : public FEProblem const std::vector _seconds_to_sleep; const bool _nested_print; + const bool _nested_print_end; const bool _nested_section; }; diff --git a/test/src/problems/SlowProblem.C b/test/src/problems/SlowProblem.C index a1b54a5025e0..61a59cabc7a6 100644 --- a/test/src/problems/SlowProblem.C +++ b/test/src/problems/SlowProblem.C @@ -25,6 +25,9 @@ SlowProblem::validParams() // Parameters to print perf graph live print interactions params.addParam( "print_during_section", false, "Whether to nest a console print inside the timed section"); + params.addParam("print_at_end_of_section", + false, + "Whether to nest a console print right at the end of the timed section"); params.addParam( "nest_inside_section", false, "Whether to nest another section inside the timed section"); @@ -35,6 +38,7 @@ SlowProblem::SlowProblem(const InputParameters & params) : FEProblem(params), _seconds_to_sleep(getParam>("seconds_to_sleep")), _nested_print(getParam("print_during_section")), + _nested_print_end(getParam("print_at_end_of_section")), _nested_section(getParam("nest_inside_section")) { if (_seconds_to_sleep.empty()) @@ -52,12 +56,18 @@ SlowProblem::solve(unsigned int nl_sys_num) TIME_SECTION("slow", 1, "Testing Slowness"); std::this_thread::sleep_for(std::chrono::duration(delay)); } - else if (_nested_print) + else if (_nested_print_end) { TIME_SECTION("slow", 1, "Testing Slowness"); _console << "Timed section just started, printing something though" << std::endl; std::this_thread::sleep_for(std::chrono::duration(delay)); } + else if (_nested_print) + { + TIME_SECTION("slow", 1, "Testing Slowness"); + std::this_thread::sleep_for(std::chrono::duration(delay)); + _console << "Timed section is about to finish" << std::endl; + } else if (_nested_section) { TIME_SECTION("slow", 1, "Testing Slowness"); @@ -74,6 +84,7 @@ SlowProblem::otherTimedSection() const { Real delay = getDelay(); TIME_SECTION("slowish", 2, "Testing Nested Slowness"); + _console << "Interrupt" << std::endl; std::this_thread::sleep_for(std::chrono::duration(delay)); } diff --git a/test/tests/utils/perf_graph_live_print/tests b/test/tests/utils/perf_graph_live_print/tests index 781275010821..0440d375977f 100644 --- a/test/tests/utils/perf_graph_live_print/tests +++ b/test/tests/utils/perf_graph_live_print/tests @@ -31,6 +31,17 @@ design = 'utils/PerfGraphLivePrint.md' requirement = 'The system shall be able to display the automatic print-out of a timed section even when an external print happened before the threshold for the automatic print-out was met.' [] + [stats_interrupted_by_regular_print] + # this test does not address the warnings 'direct to Moose::out' issue #23750 + type = RunApp + input = perf_graph_live_print.i + cli_args = 'Problem/print_at_end_of_section=true' + expect_out = "Timed section is about to finish\nFinished" + + issues = '#23746' + design = 'utils/PerfGraphLivePrint.md' + requirement = 'The system shall be able to display the automatic print-out of a timed section even when an external print happened right at the end of the timed section, before the statistics for the sections were printed.' + [] [multiapps] type = RunApp