From 116af58a149f1827e44accb3bc4bf6bf3bdef597 Mon Sep 17 00:00:00 2001 From: Levi Armstrong Date: Fri, 13 Sep 2024 11:35:44 -0500 Subject: [PATCH] Rename Timer to Stopwatch --- tesseract_examples/src/basic_cartesian_example.cpp | 4 ++-- tesseract_examples/src/glass_upright_example.cpp | 4 ++-- .../src/puzzle_piece_auxillary_axes_example.cpp | 4 ++-- tesseract_examples/src/puzzle_piece_example.cpp | 4 ++-- .../core/src/task_composer_graph.cpp | 10 +++++----- .../core/src/task_composer_node.cpp | 10 +++++----- .../core/src/task_composer_pipeline.cpp | 10 +++++----- .../core/src/task_composer_task.cpp | 1 - .../taskflow/src/taskflow_task_composer_executor.cpp | 10 +++++----- 9 files changed, 28 insertions(+), 29 deletions(-) diff --git a/tesseract_examples/src/basic_cartesian_example.cpp b/tesseract_examples/src/basic_cartesian_example.cpp index 69f2cafadb..2ff9517c4f 100644 --- a/tesseract_examples/src/basic_cartesian_example.cpp +++ b/tesseract_examples/src/basic_cartesian_example.cpp @@ -33,7 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include -#include +#include #include @@ -278,7 +278,7 @@ bool BasicCartesianExample::run() plotter_->waitForInput("Hit Enter to solve for trajectory."); // Solve task - tesseract_common::Timer stopwatch; + tesseract_common::Stopwatch stopwatch; stopwatch.start(); TaskComposerFuture::UPtr future = executor->run(*task, std::move(data)); future->wait(); diff --git a/tesseract_examples/src/glass_upright_example.cpp b/tesseract_examples/src/glass_upright_example.cpp index 41d7751ee2..fe1dbb2714 100644 --- a/tesseract_examples/src/glass_upright_example.cpp +++ b/tesseract_examples/src/glass_upright_example.cpp @@ -42,7 +42,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include -#include +#include #include #include @@ -268,7 +268,7 @@ bool GlassUprightExample::run() plotter_->waitForInput("Hit Enter to solve for trajectory."); // Solve process plan - tesseract_common::Timer stopwatch; + tesseract_common::Stopwatch stopwatch; stopwatch.start(); TaskComposerFuture::UPtr future = executor->run(*task, std::move(data)); future->wait(); diff --git a/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp b/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp index e8f1825e4a..7e71909b52 100644 --- a/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp +++ b/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp @@ -41,7 +41,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include -#include +#include #include #include @@ -311,7 +311,7 @@ bool PuzzlePieceAuxillaryAxesExample::run() data->setData("profiles", profiles); // Solve task - tesseract_common::Timer stopwatch; + tesseract_common::Stopwatch stopwatch; stopwatch.start(); TaskComposerFuture::UPtr future = executor->run(*task, std::move(data)); future->wait(); diff --git a/tesseract_examples/src/puzzle_piece_example.cpp b/tesseract_examples/src/puzzle_piece_example.cpp index fc7f6ef45f..730e53ce3a 100644 --- a/tesseract_examples/src/puzzle_piece_example.cpp +++ b/tesseract_examples/src/puzzle_piece_example.cpp @@ -41,7 +41,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include -#include +#include #include #include @@ -297,7 +297,7 @@ bool PuzzlePieceExample::run() data->setData("profiles", profiles); // Solve task - tesseract_common::Timer stopwatch; + tesseract_common::Stopwatch stopwatch; stopwatch.start(); TaskComposerFuture::UPtr future = executor->run(*task, std::move(data)); future->wait(); diff --git a/tesseract_task_composer/core/src/task_composer_graph.cpp b/tesseract_task_composer/core/src/task_composer_graph.cpp index 046a81f506..8b01d23a5b 100644 --- a/tesseract_task_composer/core/src/task_composer_graph.cpp +++ b/tesseract_task_composer/core/src/task_composer_graph.cpp @@ -36,7 +36,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include #include #include -#include +#include TESSERACT_COMMON_IGNORE_WARNINGS_POP #include @@ -224,8 +224,8 @@ std::unique_ptr TaskComposerGraph::runImpl(TaskComposerCon if (terminals_.empty()) throw std::runtime_error("TaskComposerGraph, with name '" + name_ + "' does not have terminals!"); - tesseract_common::Timer timer; - timer.start(); + tesseract_common::Stopwatch stopwatch; + stopwatch.start(); TaskComposerFuture::UPtr future = executor.value().get().run(*this, context.data_storage, context.dotgraph); future->wait(); @@ -252,14 +252,14 @@ std::unique_ptr TaskComposerGraph::runImpl(TaskComposerCon auto node_info = context.task_infos.getInfo(terminals_[i]); if (node_info != nullptr) { - timer.stop(); + stopwatch.stop(); info->input_keys = input_keys_; info->output_keys = output_keys_; info->return_value = static_cast(i); info->color = node_info->color; info->status_code = node_info->status_code; info->status_message = node_info->status_message; - info->elapsed_time = timer.elapsedSeconds(); + info->elapsed_time = stopwatch.elapsedSeconds(); return info; } } diff --git a/tesseract_task_composer/core/src/task_composer_node.cpp b/tesseract_task_composer/core/src/task_composer_node.cpp index 4aafc1450e..3328b71993 100644 --- a/tesseract_task_composer/core/src/task_composer_node.cpp +++ b/tesseract_task_composer/core/src/task_composer_node.cpp @@ -33,7 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include #include #include -#include +#include TESSERACT_COMMON_IGNORE_WARNINGS_POP #include @@ -150,9 +150,9 @@ int TaskComposerNode::run(TaskComposerContext& context, OptionalTaskComposerExec return 0; } - tesseract_common::Timer timer; + tesseract_common::Stopwatch stopwatch; TaskComposerNodeInfo::UPtr results; - timer.start(); + stopwatch.start(); try { results = runImpl(context, executor); @@ -165,11 +165,11 @@ int TaskComposerNode::run(TaskComposerContext& context, OptionalTaskComposerExec results->status_message = "Exception thrown: " + std::string(e.what()); results->return_value = 0; } - timer.stop(); + stopwatch.stop(); results->input_keys = input_keys_; results->output_keys = output_keys_; results->start_time = start_time; - results->elapsed_time = timer.elapsedSeconds(); + results->elapsed_time = stopwatch.elapsedSeconds(); int value = results->return_value; assert(value >= 0); diff --git a/tesseract_task_composer/core/src/task_composer_pipeline.cpp b/tesseract_task_composer/core/src/task_composer_pipeline.cpp index f793780215..a8aa4cc42c 100644 --- a/tesseract_task_composer/core/src/task_composer_pipeline.cpp +++ b/tesseract_task_composer/core/src/task_composer_pipeline.cpp @@ -26,7 +26,7 @@ #include TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include +#include #include TESSERACT_COMMON_IGNORE_WARNINGS_POP @@ -56,8 +56,8 @@ std::unique_ptr TaskComposerPipeline::runImpl(TaskComposer if (terminals_.empty()) throw std::runtime_error("TaskComposerPipeline, with name '" + name_ + "' does not have terminals!"); - tesseract_common::Timer timer; - timer.start(); + tesseract_common::Stopwatch stopwatch; + stopwatch.start(); boost::uuids::uuid root_node = getRootNode(); if (root_node.is_nil()) @@ -70,13 +70,13 @@ std::unique_ptr TaskComposerPipeline::runImpl(TaskComposer auto node_info = context.task_infos.getInfo(terminals_[i]); if (node_info != nullptr) { - timer.stop(); + stopwatch.stop(); auto info = std::make_unique(*this); info->return_value = static_cast(i); info->color = node_info->color; info->status_code = node_info->status_code; info->status_message = node_info->status_message; - info->elapsed_time = timer.elapsedSeconds(); + info->elapsed_time = stopwatch.elapsedSeconds(); return info; } } diff --git a/tesseract_task_composer/core/src/task_composer_task.cpp b/tesseract_task_composer/core/src/task_composer_task.cpp index 9d54317d84..9dc2a13664 100644 --- a/tesseract_task_composer/core/src/task_composer_task.cpp +++ b/tesseract_task_composer/core/src/task_composer_task.cpp @@ -30,7 +30,6 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include #include #include -#include TESSERACT_COMMON_IGNORE_WARNINGS_POP #include diff --git a/tesseract_task_composer/taskflow/src/taskflow_task_composer_executor.cpp b/tesseract_task_composer/taskflow/src/taskflow_task_composer_executor.cpp index 64314f9594..e5398b11e2 100644 --- a/tesseract_task_composer/taskflow/src/taskflow_task_composer_executor.cpp +++ b/tesseract_task_composer/taskflow/src/taskflow_task_composer_executor.cpp @@ -28,7 +28,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include #include -#include +#include #include #include #include @@ -53,8 +53,8 @@ tf::Task convertToTaskflow(const TaskComposerGraph& task_graph, tf::Subflow* parent_sbf) { auto fn = [&task_graph, &task_context, &task_executor](tf::Subflow& subflow) { - tesseract_common::Timer timer; - timer.start(); + tesseract_common::Stopwatch stopwatch; + stopwatch.start(); // Node Info auto info = std::make_unique(task_graph); @@ -112,8 +112,8 @@ tf::Task convertToTaskflow(const TaskComposerGraph& task_graph, tasks[pair.first].precede(tasks[e]); } subflow.join(); - timer.stop(); - info->elapsed_time = timer.elapsedSeconds(); + stopwatch.stop(); + info->elapsed_time = stopwatch.elapsedSeconds(); task_context.task_infos.addInfo(std::move(info)); };