Skip to content

Commit

Permalink
Merge pull request #116 from irobot-ros/asoragna/fix-linters
Browse files Browse the repository at this point in the history
fix linter errors
  • Loading branch information
alsora committed Jun 27, 2023
2 parents da50b72 + c8fd85f commit b450132
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
5 changes: 3 additions & 2 deletions performance_metrics/src/resource_usage_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ResourceUsageLogger::ResourceUsageLogger(const std::string & filename)

ResourceUsageLogger::~ResourceUsageLogger()
{
this->stop();
this->stop();
}

void ResourceUsageLogger::start(std::chrono::milliseconds period)
Expand All @@ -54,7 +54,8 @@ void ResourceUsageLogger::start(std::chrono::milliseconds period)
m_logger_thread_done = false;

// create a detached thread that monitors resource usage periodically
m_logger_thread = std::thread([ = ]() {
m_logger_thread = std::thread(
[ = ]() {
int64_t i = 1;
while (m_is_logging) {
std::this_thread::sleep_until(m_t1_real_start + period * i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ void PerformanceNodeBase::add_subscriber(
{
switch (msg_pass_by) {
case msg_pass_by_t::PASS_BY_LOANED_MSG:
RCLCPP_WARN(this->get_node_logger(),
"Requested to create sub '%s' using PASS_BY_LOANED_MSG; this will fallback to PASS_BY_SHARED_PTR",
RCLCPP_WARN(
this->get_node_logger(),
"Can't create sub '%s' using PASS_BY_LOANED_MSG; fallback to PASS_BY_SHARED_PTR",
topic_name.c_str());
[[fallthrough]];
case msg_pass_by_t::PASS_BY_SHARED_PTR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace performance_test
{

// SFINAE test to verify is a ROS 2 message has a `data` field
template <typename T>
template<typename T>
class msg_has_data_field
{
using one = char;
struct two { char x[2]; };

template <typename C> static one test(decltype(&C::set__data));
template <typename C> static two test(...);
template<typename C> static one test(decltype(&C::set__data));
template<typename C> static two test(...);

public:
enum { value = sizeof(test<T>(0)) == sizeof(char) };
Expand Down
30 changes: 15 additions & 15 deletions performance_test/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ std::unique_ptr<std::thread> System::create_spin_thread(rclcpp::Executor::Shared
}

void System::save_latency_all_stats(
const std::string & filename,
bool include_services) const
const std::string & filename,
bool include_services) const
{
if (filename.empty()) {
std::cout << "[SystemLatencyLogger]: Error. Provided an empty filename." << std::endl;
Expand All @@ -189,8 +189,8 @@ void System::save_latency_all_stats(
}

void System::save_latency_total_stats(
const std::string & filename,
bool include_services) const
const std::string & filename,
bool include_services) const
{
if (filename.empty()) {
std::cout << "[SystemLatencyLogger]: Error. Provided an empty filename." << std::endl;
Expand All @@ -211,8 +211,8 @@ void System::save_latency_total_stats(
}

void System::log_latency_all_stats(
std::ostream & stream,
bool include_services) const
std::ostream & stream,
bool include_services) const
{
std::vector<performance_metrics::Tracker> subs;

Expand All @@ -230,14 +230,14 @@ void System::log_latency_all_stats(
std::vector<performance_metrics::Tracker> clients;

for (const auto & n : m_nodes) {
auto trackers = n->client_trackers();
clients.insert(clients.end(), trackers.begin(), trackers.end());
auto trackers = n->client_trackers();
clients.insert(clients.end(), trackers.begin(), trackers.end());
}

performance_metrics::log_trackers_latency_all_stats(
stream,
clients,
"Clients stats:");
stream,
clients,
"Clients stats:");
}

std::vector<performance_metrics::Tracker> publishers;
Expand All @@ -254,16 +254,16 @@ void System::log_latency_all_stats(
}

void System::log_latency_total_stats(
std::ostream & stream,
bool include_services) const
std::ostream & stream,
bool include_services) const
{
std::vector<performance_metrics::Tracker> all_trackers;
for (const auto & n : m_nodes) {
auto sub_trackers = n->sub_trackers();
all_trackers.insert(all_trackers.end(), sub_trackers.begin(), sub_trackers.end());
if (include_services) {
auto client_trackers = n->client_trackers();
all_trackers.insert(all_trackers.end(), client_trackers.begin(), client_trackers.end());
auto client_trackers = n->client_trackers();
all_trackers.insert(all_trackers.end(), client_trackers.begin(), client_trackers.end());
}
}
performance_metrics::log_trackers_latency_total_stats(stream, all_trackers);
Expand Down

0 comments on commit b450132

Please sign in to comment.