mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 23:31:36 +08:00
load_mon: get mem_usage by reading /proc/meminfo on Linux
This commit is contained in:
@@ -33,7 +33,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/perf/perf_counter.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
@@ -48,7 +50,6 @@
|
||||
|
||||
#if defined(__PX4_LINUX)
|
||||
#include <sys/times.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
namespace load_mon
|
||||
@@ -92,6 +93,7 @@ private:
|
||||
uORB::Publication<cpuload_s> _cpuload_pub {ORB_ID(cpuload)};
|
||||
|
||||
#if defined(__PX4_LINUX)
|
||||
FILE *_proc_fd = nullptr;
|
||||
/* calculate usage directly from clock ticks on Linux */
|
||||
clock_t _last_total_time_stamp{};
|
||||
clock_t _last_spent_time_stamp{};
|
||||
|
||||
Reference in New Issue
Block a user