27 #include <boost/lexical_cast.hpp>
57 unsigned long cminflt;
59 unsigned long cmajflt;
72 unsigned long startcode;
73 unsigned long endcode;
74 unsigned long startstack;
75 unsigned long kstkesp;
76 unsigned long kstkeip;
79 unsigned long sigignore;
88 friend Fetcher&
operator>>(Fetcher&,
unsigned int&);
89 friend Fetcher&
operator>>(Fetcher&,
unsigned long&);
93 explicit Fetcher(
char* buffer) :
96 delims_(
" \t\n\f\v\r") {
100 const char*
t = getItem();
102 return boost::lexical_cast<
int>(
t);
105 const char*
t = getItem();
107 return boost::lexical_cast<
long>(
t);
109 unsigned int getUInt() {
110 const char*
t = getItem();
112 return boost::lexical_cast<
unsigned int>(
t);
114 unsigned long getULong() {
115 const char*
t = getItem();
117 return boost::lexical_cast<
unsigned long>(
t);
126 char* item = strtok_r(buffer_, delims_, &save_);
133 char const*
const delims_;
136 Fetcher&
operator>>(Fetcher& iFetch,
int& oValue) {
137 oValue = iFetch.getInt();
140 Fetcher&
operator>>(Fetcher& iFetch,
long& oValue) {
141 oValue = iFetch.getLong();
144 Fetcher&
operator>>(Fetcher& iFetch,
unsigned int& oValue) {
145 oValue = iFetch.getUInt();
148 Fetcher&
operator>>(Fetcher& iFetch,
unsigned long& oValue) {
149 oValue = iFetch.getULong();
152 Fetcher&
operator>>(Fetcher& iFetch,
char& oValue) {
153 oValue = iFetch.getChar();
157 oValue = iFetch.getString();
166 pg_size_(sysconf(_SC_PAGESIZE)) {
168 std::ostringstream ost;
169 ost <<
"/proc/" << getpid() <<
"/stat";
171 if((
fd_ = open(ost.str().c_str(), O_RDONLY)) < 0) {
173 <<
"Failed to open " << ost.str() << std::endl;
186 double pr_size = 0.0, pr_rssize = 0.0;
191 lseek(
fd_, 0, SEEK_SET);
194 perror(
"Read of Proc file failed:");
203 Fetcher fetcher(
buf_);
239 }
catch (boost::bad_lexical_cast& iE) {
240 LogWarning(
"ProcInfoFetcher")<<
"Parsing of Prof file failed:"<<iE.what()<<std::endl;
245 pr_size = (double)pinfo.vsize;
246 pr_rssize = (
double)pinfo.rss;
248 ret.
vsize = pr_size / (1024.0*1024.0);
249 ret.
rss = (pr_rssize *
pg_size_) / (1024.0*1024.0);
std::vector< Variable::Flags > flags
int getInt(ResultSet *rset, int ipar)
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)