Go to the documentation of this file.
10 #include <fmt/format.h>
16 namespace process_info
29 fmt::print(stderr,
"Warning: Could not obtain value of USER_HZ."
30 "CPU load measurements might be inaccurate.\n"
46 fmt::print(stderr,
"Warning: Could not obtain page size.");
56 FILE*
f = fopen(filename,
"r");
61 int ret = fread(buf, 1,
sizeof(buf)-1,
f);
69 unsigned long pid = 0;
70 if(sscanf(buf,
"%lu", &pid) != 1)
74 char*
start = strrchr(buf,
')');
76 if(
start - buf > (
int)strlen(buf) - 4)
82 unsigned long pgrp = 0;
83 long long unsigned int user_jiffies = 0;
84 long long unsigned int kernel_jiffies = 0;
85 long long unsigned int rss_pages = 0;
123 stat->
utime = user_jiffies;
124 stat->
stime = kernel_jiffies;
std::size_t page_size()
Kernel page size.
unsigned long pgrp
Process group ID.
std::size_t mem_rss
Resident memory size in bytes.
static jiffies_t g_kernel_hz
bool readStatFile(const char *filename, ProcessStat *stat)
unsigned long jiffies_t
A time value counted in kernel jiffies.
jiffies_t kernel_hz()
Number of kernel jiffies per second.
jiffies_t utime
Total time spent in userspace.
static std::size_t g_page_size
jiffies_t stime
Total time spent in kernel space.
rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Feb 21 2024 04:01:14