ATLAS Offline Software
Control
CoWTools
src
Monitor.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CoWTools/Monitor.h
"
6
#include "
CoWTools/StrStream.h
"
7
#include "
CoWTools/MStrStream.h
"
8
#include "
CoWTools/VecStream.h
"
9
#include <sstream>
10
#include <fstream>
11
12
namespace
CoWTools
{
13
Monitor::Monitor
(std::string &
out
){
14
m_out
=
new
CoWTools::StrStream
(
out
);
15
m_stats
=
parseSmaps
();
16
}
17
18
Monitor::Monitor
(MsgStream &
out
){
19
m_out
=
new
CoWTools::MStrStream
(
out
);
20
m_stats
=
parseSmaps
();
21
}
22
23
Monitor::Monitor
(std::vector<long> &
out
){
24
m_out
=
new
CoWTools::VecStream
(
out
);
25
m_stats
=
parseSmaps
();
26
}
27
Monitor::~Monitor
(){
28
m_stats
=
parseSmaps
()-
m_stats
;
29
m_out
->
putResults
(
m_stats
);
30
delete
m_out
;
31
}
32
33
const
CoWTools::CoWRecordStats
Monitor::parseSmaps
()
const
{
34
std::ifstream
pfile
(
"/proc/self/smaps"
);
35
CoWTools::CoWRecordStats
total,curr;
36
if
(
pfile
.is_open()){
37
std::string
line
;
38
std::stringstream
ss
;
39
std::string libLine;
40
while
(!std::getline(
pfile
,
line
).eof()){
41
if
(
line
.empty())
continue
;
42
if
(
line
.size()>30 &&
line
.at(0)!=
'V'
){
43
ss
.seekg(0);
44
curr.
parseRecord
(
ss
);
45
total+=curr;
46
ss
.str(
""
);
47
ss
.clear();
48
continue
;
49
}
50
ss
<<
line
<<std::endl;
51
ss
.clear();
52
}
53
if
(
ss
.str().size()>200){
54
curr.
parseRecord
(
ss
);
55
total+=curr;
56
}
57
pfile
.close();
58
}
59
return
total;
60
}
61
}
CoWTools::Monitor::m_stats
CoWTools::CoWRecordStats m_stats
Definition:
Monitor.h:29
checkFileSG.line
line
Definition:
checkFileSG.py:75
CoWTools::Monitor::m_out
StreamBase * m_out
Definition:
Monitor.h:28
PowhegControl_ttHplus_NLO.ss
ss
Definition:
PowhegControl_ttHplus_NLO.py:83
CoWTools::Monitor::parseSmaps
const CoWTools::CoWRecordStats parseSmaps() const
Definition:
Monitor.cxx:33
LArNewCalib_Delay_OFC_Cali.pfile
string pfile
Definition:
LArNewCalib_Delay_OFC_Cali.py:181
StrStream.h
CoWTools::VecStream
Definition:
VecStream.h:16
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
MStrStream.h
CoWTools::Monitor::~Monitor
~Monitor()
Definition:
Monitor.cxx:27
CoWTools::StreamBase::putResults
virtual void putResults(const CoWRecordStats &)=0
CoWTools::StrStream
Definition:
StrStream.h:14
CoWTools::Monitor::Monitor
Monitor(std::string &out)
Definition:
Monitor.cxx:13
CoWTools::MStrStream
Definition:
MStrStream.h:15
CoWTools::CoWRecordStats::parseRecord
void parseRecord(std::istream &in)
Definition:
CoWRecordStats.cxx:40
CoWTools::CoWRecordStats
Definition:
CoWRecordStats.h:13
CoWTools
Definition:
CoWLibrary.h:15
VecStream.h
Monitor.h
Generated on Wed Jan 8 2025 21:13:54 for ATLAS Offline Software by
1.8.18