From 6bef021e1bb0789ef7f22d51e098b8e9c10d5d65 Mon Sep 17 00:00:00 2001 From: Max Schwarz Date: Fri, 27 Dec 2019 15:20:31 +0100 Subject: [PATCH] rosmon_core: fix a lot of whitespace issues introduced in #76 --- rosmon_core/src/launch/launch_config.cpp | 5 ++-- rosmon_core/src/launch/launch_config.h | 8 +++--- rosmon_core/src/launch/node.cpp | 4 +-- rosmon_core/src/launch/node.h | 17 +++++------ rosmon_core/src/main.cpp | 36 ++++++++++++------------ rosmon_core/src/monitor/node_monitor.h | 8 +++--- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/rosmon_core/src/launch/launch_config.cpp b/rosmon_core/src/launch/launch_config.cpp index 9d3d256..d471b49 100644 --- a/rosmon_core/src/launch/launch_config.cpp +++ b/rosmon_core/src/launch/launch_config.cpp @@ -298,9 +298,8 @@ void LaunchConfig::parseNode(TiXmlElement* element, ParseContext& attr_ctx) const char* cwd = element->Attribute("cwd"); const char* clearParams = element->Attribute("clear_params"); const char* stopTimeout = element->Attribute("rosmon-stop-timeout"); - const char* memoryLimit = element->Attribute("rosmon-memory-limit"); - const char* cpuLimit = element->Attribute("rosmon-cpu-limit"); - + const char* memoryLimit = element->Attribute("rosmon-memory-limit"); + const char* cpuLimit = element->Attribute("rosmon-cpu-limit"); if(!name || !pkg || !type) { diff --git a/rosmon_core/src/launch/launch_config.h b/rosmon_core/src/launch/launch_config.h index 4670de7..ec74ef7 100644 --- a/rosmon_core/src/launch/launch_config.h +++ b/rosmon_core/src/launch/launch_config.h @@ -167,8 +167,8 @@ class LaunchConfig void setArgument(const std::string& name, const std::string& value); void setDefaultStopTimeout(double timeout); - void setDefaultCPULimit(double CPULimit); - void setDefaultMemoryLimit(uint64_t memoryLimit); + void setDefaultCPULimit(double CPULimit); + void setDefaultMemoryLimit(uint64_t memoryLimit); void parse(const std::string& filename, bool onlyArguments = false); void parseString(const std::string& input, bool onlyArguments = false); @@ -239,8 +239,8 @@ class LaunchConfig std::string m_windowTitle; double m_defaultStopTimeout{DEFAULT_STOP_TIMEOUT}; - uint64_t m_defaultMemoryLimit{DEFAULT_MEMORY_LIMIT}; - double m_defaultCPULimit{DEFAULT_CPU_LIMIT}; + uint64_t m_defaultMemoryLimit{DEFAULT_MEMORY_LIMIT}; + double m_defaultCPULimit{DEFAULT_CPU_LIMIT}; }; } diff --git a/rosmon_core/src/launch/node.cpp b/rosmon_core/src/launch/node.cpp index 301821b..aeb0f6f 100644 --- a/rosmon_core/src/launch/node.cpp +++ b/rosmon_core/src/launch/node.cpp @@ -147,12 +147,12 @@ void Node::setStopTimeout(double timeout) void Node::setMemoryLimit(uint64_t memoryLimitByte) { - m_memoryLimitByte = memoryLimitByte; + m_memoryLimitByte = memoryLimitByte; } void Node::setCPULimit(float cpuLimit) { - m_cpuLimit = cpuLimit; + m_cpuLimit = cpuLimit; } } diff --git a/rosmon_core/src/launch/node.h b/rosmon_core/src/launch/node.h index 2d3f3b0..ba80e9b 100644 --- a/rosmon_core/src/launch/node.h +++ b/rosmon_core/src/launch/node.h @@ -42,9 +42,9 @@ class Node void setStopTimeout(double timeout); - void setMemoryLimit(uint64_t memoryLimitByte); + void setMemoryLimit(uint64_t memoryLimitByte); - void setCPULimit(float cpuLimit); + void setCPULimit(float cpuLimit); std::string name() const { return m_name; } @@ -96,11 +96,12 @@ class Node double stopTimeout() const { return m_stopTimeout; } - uint64_t memoryLimitByte()const - { return m_memoryLimitByte;} + uint64_t memoryLimitByte() const + { return m_memoryLimitByte;} + + float cpuLimit() const + { return m_cpuLimit; } - float cpuLimit()const - { return m_cpuLimit; } private: std::string m_name; std::string m_package; @@ -130,8 +131,8 @@ class Node double m_stopTimeout; - uint64_t m_memoryLimitByte; - float m_cpuLimit; + uint64_t m_memoryLimitByte; + float m_cpuLimit; }; } diff --git a/rosmon_core/src/main.cpp b/rosmon_core/src/main.cpp index 47e814b..c579f02 100644 --- a/rosmon_core/src/main.cpp +++ b/rosmon_core/src/main.cpp @@ -74,18 +74,18 @@ void usage() " --stop-timeout=SECONDS\n" " Kill a process if it is still running this long\n" " after the initial signal is send.\n" - " --disable-diagnostics\n" - " Disable publication of ros diagnostics message about\n" - " monitored nodes\n" - " --diagnostics-prefix=PREFIX\n" - " Prefix for the ros diagnostics generated by this node.\n" - " By default this will be the node name.\n" - " --cpu-limit=[0-n]\n" - " Default CPU Usage limit of monitored process. n is the\n" - " number of CPU cores. This is the sum of system and user\n" - " CPU usage.\n" - " --memory-limit=15MB\n" - " Default memory limit usage of monitored process.\n" + " --disable-diagnostics\n" + " Disable publication of ros diagnostics message about\n" + " monitored nodes\n" + " --diagnostics-prefix=PREFIX\n" + " Prefix for the ros diagnostics generated by this node.\n" + " By default this will be the node name.\n" + " --cpu-limit=[0-n]\n" + " Default CPU Usage limit of monitored process. n is the\n" + " number of CPU cores. This is the sum of system and user\n" + " CPU usage.\n" + " --memory-limit=15MB\n" + " Default memory limit usage of monitored process.\n" "\n" "rosmon also obeys some environment variables:\n" " ROSMON_COLOR_MODE Can be set to 'truecolor', '256colors', 'ansi'\n" @@ -127,10 +127,10 @@ static const struct option OPTIONS[] = { {"name", required_argument, nullptr, 'n'}, {"no-start", no_argument, nullptr, 'S'}, {"stop-timeout", required_argument, nullptr, 's'}, - {"disable-diagnostics", no_argument, nullptr, 'D'}, - {"cpu-limit", required_argument, nullptr, 'c'}, - {"memory-limit", required_argument, nullptr, 'm'}, - {"diagnostics-prefix", required_argument, nullptr, 'p'}, + {"disable-diagnostics", no_argument, nullptr, 'D'}, + {"cpu-limit", required_argument, nullptr, 'c'}, + {"memory-limit", required_argument, nullptr, 'm'}, + {"diagnostics-prefix", required_argument, nullptr, 'p'}, {nullptr, 0, nullptr, 0} }; @@ -332,8 +332,8 @@ int main(int argc, char** argv) rosmon::launch::LaunchConfig::Ptr config(new rosmon::launch::LaunchConfig); config->setDefaultStopTimeout(stopTimeout); - config->setDefaultCPULimit(cpuLimit); - config->setDefaultMemoryLimit(memoryLimit); + config->setDefaultCPULimit(cpuLimit); + config->setDefaultMemoryLimit(memoryLimit); // Parse launch file arguments from command line for(int i = firstArg; i < argc; ++i) diff --git a/rosmon_core/src/monitor/node_monitor.h b/rosmon_core/src/monitor/node_monitor.h index 0971134..0c2f01f 100644 --- a/rosmon_core/src/monitor/node_monitor.h +++ b/rosmon_core/src/monitor/node_monitor.h @@ -149,11 +149,11 @@ class NodeMonitor inline unsigned int restartCount() const { return m_restartCount; } - inline uint64_t memoryLimit()const - { return m_launchNode->memoryLimitByte();} + inline uint64_t memoryLimit() const + { return m_launchNode->memoryLimitByte();} - inline float cpuLimit()const - { return m_launchNode->cpuLimit();} + inline float cpuLimit() const + { return m_launchNode->cpuLimit();} //@}