File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,11 +36,8 @@ namespace o2
3636namespace monitoring
3737{
3838
39- # ifdef O2_MONITORING_OS_CC7
39+ static constexpr auto SMAPS_ROLLUP_FILE = " /proc/self/smaps_rollup " ;
4040static constexpr auto SMAPS_FILE = " /proc/self/smaps" ;
41- #else
42- static constexpr auto SMAPS_FILE = " /proc/self/smaps_rollup" ;
43- #endif
4441
4542#ifdef O2_MONITORING_OS_LINUX
4643namespace
@@ -148,7 +145,9 @@ std::vector<Metric> ProcessMonitor::getMemoryUsage()
148145
149146std::vector<Metric> ProcessMonitor::getSmaps ()
150147{
151- std::ifstream statusStream (SMAPS_FILE );
148+ static const char * const smapsFile =
149+ (::access (SMAPS_ROLLUP_FILE , R_OK ) == 0 ) ? SMAPS_ROLLUP_FILE : SMAPS_FILE ;
150+ std::ifstream statusStream (smapsFile);
152151 double pssTotal = 0 ;
153152 double cleanTotal = 0 ;
154153 double dirtyTotal = 0 ;
You can’t perform that action at this time.
0 commit comments