Skip to content

Commit

Permalink
Change to make_shared
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <brawner@gmail.com>
  • Loading branch information
brawner committed Oct 22, 2020
1 parent 87d4af0 commit 94bc919
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rclcpp/test/benchmark/benchmark_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class NodePerformanceTest : public PerformanceTest
BENCHMARK_F(NodePerformanceTest, create_node)(benchmark::State & state)
{
// Warmup and prime caches
auto outer_node = std::make_unique<rclcpp::Node>("node");
auto outer_node = std::make_shared<rclcpp::Node>("node");
outer_node.reset();

reset_heap_counters();
for (auto _ : state) {
// Using pointer to separate construction and destruction in timing
auto node = std::make_unique<rclcpp::Node>("node");
auto node = std::make_shared<rclcpp::Node>("node");
benchmark::DoNotOptimize(node);
benchmark::ClobberMemory();

Expand All @@ -59,14 +59,14 @@ BENCHMARK_F(NodePerformanceTest, create_node)(benchmark::State & state)
BENCHMARK_F(NodePerformanceTest, destroy_node)(benchmark::State & state)
{
// Warmup and prime caches
auto outer_node = std::make_unique<rclcpp::Node>("node");
auto outer_node = std::make_shared<rclcpp::Node>("node");
outer_node.reset();

reset_heap_counters();
for (auto _ : state) {
// Using pointer to separate construction and destruction in timing
state.PauseTiming();
auto node = std::make_unique<rclcpp::Node>("node");
auto node = std::make_shared<rclcpp::Node>("node");
state.ResumeTiming();

benchmark::DoNotOptimize(node);
Expand Down

0 comments on commit 94bc919

Please sign in to comment.