55 unsigned long cminflt;
57 unsigned long cmajflt;
66 unsigned long long starttime;
70 unsigned long startcode;
71 unsigned long endcode;
72 unsigned long startstack;
73 unsigned long kstkesp;
74 unsigned long kstkeip;
76 unsigned long blocked;
77 unsigned long sigignore;
78 unsigned long sigcatch;
86 friend Fetcher&
operator>>(Fetcher&,
unsigned int&);
87 friend Fetcher&
operator>>(Fetcher&,
unsigned long&);
88 friend Fetcher&
operator>>(Fetcher&,
unsigned long long&);
92 explicit Fetcher(
char*
buffer) : buffer_(
buffer), save_(nullptr), delims_(
" \t\n\f\v\r") {}
96 const char*
t = getItem();
101 const char*
t = getItem();
105 unsigned int getUInt() {
106 const char*
t = getItem();
108 return std::stoul(
t);
110 unsigned long getULong() {
111 const char*
t = getItem();
113 return std::stoul(
t);
115 unsigned long long getULongLong() {
116 const char*
t = getItem();
118 return std::stoull(
t);
120 char getChar() {
return *getItem(); }
123 char*
item = strtok_r(buffer_, delims_, &
save());
134 char const*
const delims_;
137 Fetcher&
operator>>(Fetcher& iFetch,
int& oValue) {
138 oValue = iFetch.getInt();
141 Fetcher&
operator>>(Fetcher& iFetch,
long& oValue) {
142 oValue = iFetch.getLong();
145 Fetcher&
operator>>(Fetcher& iFetch,
unsigned int& oValue) {
146 oValue = iFetch.getUInt();
149 Fetcher&
operator>>(Fetcher& iFetch,
unsigned long& oValue) {
150 oValue = iFetch.getULong();
153 Fetcher&
operator>>(Fetcher& iFetch,
unsigned long long& oValue) {
154 oValue = iFetch.getULongLong();
157 Fetcher&
operator>>(Fetcher& iFetch,
char& oValue) {
158 oValue = iFetch.getChar();
162 oValue = iFetch.getString();
172 std::ostringstream ost;
173 ost <<
"/proc/" << getpid() <<
"/stat";
175 if ((
fd_ = open(ost.str().c_str(), O_RDONLY)) < 0) {
189 double pr_size = 0.0, pr_rssize = 0.0;
194 lseek(
fd_, 0, SEEK_SET);
197 perror(
"Read of Proc file failed:");
205 Fetcher fetcher(
buf_);
206 fetcher >> pinfo.pid >> pinfo.comm >> pinfo.state >> pinfo.ppid >> pinfo.pgrp >> pinfo.session >> pinfo.tty >>
207 pinfo.tpgid >> pinfo.flags >> pinfo.minflt >> pinfo.cminflt >> pinfo.majflt >> pinfo.cmajflt >>
208 pinfo.utime >> pinfo.stime >> pinfo.cutime >> pinfo.cstime >> pinfo.priority >> pinfo.nice >>
209 pinfo.num_threads >> pinfo.itrealvalue >> pinfo.starttime >> pinfo.vsize >> pinfo.rss >> pinfo.rlim >>
210 pinfo.startcode >> pinfo.endcode >> pinfo.startstack >> pinfo.kstkesp >> pinfo.kstkeip >> pinfo.signal >>
211 pinfo.blocked >> pinfo.sigignore >> pinfo.sigcatch >> pinfo.wchan;
213 LogWarning(
"ProcInfoFetcher") <<
"Parsing of Prof file failed:" << iE.what() << std::endl;
218 pr_size = (double)pinfo.vsize;
219 pr_rssize = (
double)pinfo.rss;
221 ret.vsize = pr_size / (1024.0 * 1024.0);
222 ret.rss = (pr_rssize *
pg_size_) / (1024.0 * 1024.0);
ret
prodAgent to be discontinued
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
int getInt(ResultSet *rset, int ipar)
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)
Log< level::Warning, false > LogWarning