#include <LinuxProcMgr.h>
Definition at line 22 of file LinuxProcMgr.h.
art::LinuxProcMgr::LinuxProcMgr |
( |
| ) |
|
|
noexcept |
art::LinuxProcMgr::~LinuxProcMgr |
( |
| ) |
|
|
noexcept |
Definition at line 69 of file LinuxProcMgr.cc.
71 HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
73 int const seek_result{fseek(
file_, 0, SEEK_SET)};
74 if (seek_result != 0) {
76 "Error while retrieving Linux proc data."}
77 <<
"\nCould not reset position indicator while retrieving proc " 78 "stat information.\n";
82 size_t const cnt{fread(buf, 1,
sizeof(buf),
file_)};
86 "Error while retrieving Linux proc data."}
87 <<
"\nCould not read proc stat information.\n";
95 std::istringstream iss{buf};
96 iss >> token_ignore(22) >> vsize >> rss;
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
static auto make_proc_tuple(vsize_t::value_type const vsize={}, rss_t::value_type const rss={})
double art::LinuxProcMgr::getStatusData_ |
( |
std::string const & |
field | ) |
const |
|
privatenoexcept |
Definition at line 103 of file LinuxProcMgr.cc.
105 HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
107 std::ostringstream ost;
108 ost <<
"/proc/" <<
pid_ <<
"/status";
110 auto file = fopen(ost.str().c_str(),
"r");
111 if (
file ==
nullptr) {
117 std::regex
const pattern{
"^" + field + R
"(:\s*(\d+)\s*kB)"}; 118 while (!feof(
file)) {
120 if (fgets(buffer,
sizeof(buffer),
file) !=
nullptr) {
122 if (std::regex_search(buffer, cm,
pattern)) {
static constexpr double cm
static constexpr double KiB
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
static constexpr double MB
QTextStream & endl(QTextStream &s)
double art::LinuxProcMgr::getVmHWM |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 34 of file LinuxProcMgr.h.
double getStatusData_(std::string const &field) const noexcept(false)
double art::LinuxProcMgr::getVmPeak |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 29 of file LinuxProcMgr.h.
double getStatusData_(std::string const &field) const noexcept(false)
FILE* const art::LinuxProcMgr::file_ |
|
private |
long const art::LinuxProcMgr::pgSize_ |
|
private |
pid_t const art::LinuxProcMgr::pid_ |
|
private |
The documentation for this class was generated from the following files: