CMS 3D CMS Logo

pidInfo.cc

Go to the documentation of this file.
00001 #include<iostream>
00002 #include "Utilities/Notification/interface/pidInfo.h"
00003 
00004 const unsigned int pidInfo::pagesz=4;
00005 
00006 #include "Utilities/General/interface/MutexUtils.h"
00007 
00008 pidInfo::pidInfo(const std::string & s) {
00009   std::ostream & co = TSafeOstream();
00010   co <<"Memory use in kb," <<s<< std::endl;
00011   load(&co);
00012 }
00013 
00014 pidInfo::pidInfo(std::ostream & co, const std::string & s) {
00015   co <<"Memory use in kb," <<s<< std::endl;
00016   load(&co);
00017 
00018 }
00019 
00020 pidInfo::pidInfo() {
00021   load(0);
00022 }
00023 
00024 #include <fstream>
00025 void pidInfo::load(std::ostream * co) {
00026   unsigned int sharedsz;
00027   unsigned int textsz;
00028   unsigned int datasz;
00029   unsigned int libsz;
00030   unsigned int dtsz;
00031 
00032   std::ifstream statm("/proc/self/statm");
00033   statm >> memsz >> rsssz >> sharedsz >> textsz >> datasz
00034         >> libsz >> dtsz;
00035   statm.close();
00036 
00037   if (!co) return;
00038 
00039 
00040   (*co) << "Total memory=" << pagesz*memsz
00041         << ", Resident=" << pagesz*rsssz
00042         << ", Shared=" << pagesz*sharedsz
00043         << ", Text=" << pagesz*textsz
00044         << ", Data=" << pagesz*datasz
00045         << ", Libraries=" << pagesz*libsz
00046         << ", Dirty pages=" << pagesz*dtsz
00047         << std::endl;
00048 }
00049 

Generated on Tue Jun 9 17:48:52 2009 for CMSSW by  doxygen 1.5.4