ATLAS Offline Software
AthMonBench.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "AthMonBench.h"
6 #include <iostream>
7 #include <limits>
8 #include <string>
9 #include <fstream>
10 
11 namespace{
12  template <long f>
13  long
14  multiply(long result){
15  static constexpr long maxval = std::numeric_limits<long>::max()/f;
16  if ((result>maxval) or (result<0)) return -1;
17  return result * f;
18  }
19 }
20 
23  long result = -1;
24  std::ifstream file("/proc/self/status");
25  const std::string search{"VmSize:"};
26  std::string line;
27  while(getline(file, line)) {
28  if (line.starts_with(search)) {
29  result = std::stol(line.substr(search.size()));
30  result = multiply<1024L>(result);
31  break;
32  }
33  }
34  return result;
35 }
36 
37 std::ostream& operator << ( std::ostream& os, const AthMonBench& br) {
38  if (br.valid())
39  os << "deltaMem: "<<br.deltaMem_mb()<<" mb, deltaCPU: "<<br.deltaCPU_ms()<<" ms";
40  else
41  os <<" [no data]";
42  return os;
43 }
checkFileSG.line
line
Definition: checkFileSG.py:75
get_generator_info.result
result
Definition: get_generator_info.py:21
AthMonBench::currentVMem
static TMem currentVMem()
Definition: AthMonBench.cxx:22
operator<<
std::ostream & operator<<(std::ostream &os, const AthMonBench &br)
Definition: AthMonBench.cxx:37
MuonR4::multiply
Amg::Vector3D multiply(const CalibratedSpacePoint::Covariance_t &mat, const Amg::Vector3D &v)
Multiplies a 3D vector with the covariance matrix which can be either 2x2 or 3x3 matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:40
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
search
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition: hcg.cxx:738
file
TFile * file
Definition: tile_monitor.h:29
hist_file_dump.f
f
Definition: hist_file_dump.py:135
AthMonBench::TMem
long long TMem
Definition: AthMonBench.h:52
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
AthMonBench.h
AthMonBench
Definition: AthMonBench.h:25
PlotCalibFromCool.br
br
Definition: PlotCalibFromCool.py:355