Skip to content

Commit

Permalink
Rename Timer to Stopwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Sep 13, 2024
1 parent dd09e27 commit 2da18ce
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 29 deletions.
4 changes: 2 additions & 2 deletions tesseract_examples/src/basic_cartesian_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_examples/basic_cartesian_example.h>

#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>

#include <tesseract_collision/core/types.h>

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions tesseract_examples/src/glass_upright_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
#include <tesseract_environment/commands/add_link_command.h>
#include <tesseract_environment/utils.h>

#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>

#include <tesseract_command_language/profile_dictionary.h>
#include <tesseract_command_language/composite_instruction.h>
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
#include <tesseract_environment/utils.h>

#include <tesseract_common/resource_locator.h>
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>

#include <tesseract_command_language/profile_dictionary.h>
#include <tesseract_command_language/composite_instruction.h>
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions tesseract_examples/src/puzzle_piece_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
#include <tesseract_environment/utils.h>

#include <tesseract_common/resource_locator.h>
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>

#include <tesseract_command_language/profile_dictionary.h>
#include <tesseract_command_language/composite_instruction.h>
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions tesseract_task_composer/core/src/task_composer_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <tesseract_common/serialization.h>
#include <tesseract_common/plugin_info.h>
#include <tesseract_common/yaml_utils.h>
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>
TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_task_composer/core/task_composer_context.h>
Expand Down Expand Up @@ -224,8 +224,8 @@ std::unique_ptr<TaskComposerNodeInfo> 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();
Expand All @@ -252,14 +252,14 @@ std::unique_ptr<TaskComposerNodeInfo> 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<int>(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;
}
}
Expand Down
10 changes: 5 additions & 5 deletions tesseract_task_composer/core/src/task_composer_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <boost/uuid/uuid_serialize.hpp>
#include <yaml-cpp/yaml.h>
#include <tesseract_common/serialization.h>
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>
TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_task_composer/core/task_composer_context.h>
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions tesseract_task_composer/core/src/task_composer_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <tesseract_common/macros.h>
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>
#include <tesseract_common/serialization.h>
TESSERACT_COMMON_IGNORE_WARNINGS_POP

Expand Down Expand Up @@ -56,8 +56,8 @@ std::unique_ptr<TaskComposerNodeInfo> 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())
Expand All @@ -70,13 +70,13 @@ std::unique_ptr<TaskComposerNodeInfo> 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<TaskComposerNodeInfo>(*this);
info->return_value = static_cast<int>(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;
}
}
Expand Down
1 change: 0 additions & 1 deletion tesseract_task_composer/core/src/task_composer_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <yaml-cpp/yaml.h>
#include <boost/serialization/base_object.hpp>
#include <tesseract_common/serialization.h>
#include <tesseract_common/timer.h>
TESSERACT_COMMON_IGNORE_WARNINGS_POP

#include <tesseract_task_composer/core/task_composer_task.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <tesseract_common/serialization.h>
#include <tesseract_common/utils.h>
#include <tesseract_common/timer.h>
#include <tesseract_common/stopwatch.h>
#include <taskflow/taskflow.hpp>
#include <yaml-cpp/yaml.h>
#include <boost/uuid/uuid.hpp>
Expand All @@ -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<TaskComposerNodeInfo>(task_graph);
Expand Down Expand Up @@ -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));
};

Expand Down

0 comments on commit 2da18ce

Please sign in to comment.