Skip to content

Commit

Permalink
rosmon_core: fix a lot of whitespace issues introduced in #76
Browse files Browse the repository at this point in the history
  • Loading branch information
xqms committed Dec 27, 2019
1 parent c9a37bc commit 6bef021
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
5 changes: 2 additions & 3 deletions rosmon_core/src/launch/launch_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions rosmon_core/src/launch/launch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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};
};

}
Expand Down
4 changes: 2 additions & 2 deletions rosmon_core/src/launch/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
Expand Down
17 changes: 9 additions & 8 deletions rosmon_core/src/launch/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -130,8 +131,8 @@ class Node

double m_stopTimeout;

uint64_t m_memoryLimitByte;
float m_cpuLimit;
uint64_t m_memoryLimitByte;
float m_cpuLimit;
};

}
Expand Down
36 changes: 18 additions & 18 deletions rosmon_core/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}
};

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions rosmon_core/src/monitor/node_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();}

//@}

Expand Down

0 comments on commit 6bef021

Please sign in to comment.