Skip to content

Commit 40cbc20

Browse files
author
Mehmet Emin BAŞOĞLU
committed
fix: pidstat params
Signed-off-by: Mehmet Emin BAŞOĞLU <memin@leodrive.ai>
1 parent 85aced4 commit 40cbc20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

system/autoware_component_monitor/src/component_monitor_node.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ uint32_t ComponentMonitor::to_uint32(const std::string & str)
118118
/**
119119
* @brief Get CPU usage of the component.
120120
*
121-
* @details The output of `pidstat -u -p PID` is like below:
121+
* @details The output of `pidstat -u -h 1 1 -p PID` is like below:
122122
*
123123
* Linux 6.5.0-35-generic (leopc) 21-05-2024 _x86_64_ (16 CPU)
124124
* 14:54:52 UID PID %usr %system %guest %wait %CPU CPU Command
@@ -128,7 +128,7 @@ uint32_t ComponentMonitor::to_uint32(const std::string & str)
128128
*/
129129
void ComponentMonitor::get_cpu_usage()
130130
{
131-
std::string cmd{"pidstat -u -p "};
131+
std::string cmd{"pidstat -u -h 1 1 -p "};
132132
cmd += std::to_string(pid_);
133133

134134
auto std_out = run_command(cmd);
@@ -141,7 +141,7 @@ void ComponentMonitor::get_cpu_usage()
141141
/**
142142
* @brief Get memory usage of the component.
143143
*
144-
* @details The output of `pidstat -r -p PID` is like below:
144+
* @details The output of `pidstat -r -h 1 1 -p PID` is like below:
145145
*
146146
* Linux 6.5.0-35-generic (leopc) 21-05-2024 _x86_64_ (16 CPU)
147147
* 14:54:52 UID PID minflt/s majflt/s VSZ RSS %MEM Command
@@ -151,7 +151,7 @@ void ComponentMonitor::get_cpu_usage()
151151
*/
152152
void ComponentMonitor::get_mem_usage()
153153
{
154-
std::string cmd{"pidstat -r -p "};
154+
std::string cmd{"pidstat -r -h 1 1 -p "};
155155
cmd += std::to_string(pid_);
156156

157157
auto std_out = run_command(cmd);

0 commit comments

Comments
 (0)