/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
MemoryCheck::checkMemory Class Reference
Inheritance diagram for MemoryCheck::checkMemory:
Inheritance graph
[legend]
Collaboration diagram for MemoryCheck::checkMemory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 execNumber
 virt
 res
 virtMax
 virtMin
 resMax
 resMin
 histSvc
 hist

Detailed Description

Definition at line 18 of file __init__.py.


Constructor & Destructor Documentation

def MemoryCheck::checkMemory::__init__ (   self,
  name 
)

Definition at line 20 of file __init__.py.

00021                            :
00022         GaudiAlgo.__init__(self,name)
00023 
00024         return


Member Function Documentation

def MemoryCheck::checkMemory::initialize (   self)

Definition at line 25 of file __init__.py.

00026                         :
00027         print "Initializing Check Memory", self.name()
00028         status = GaudiAlgo.initialize(self)
00029         if status.isFailure(): 
00030             return status
00031 
00032         self.execNumber = 0
00033         self.virt = {}
00034         self.res = {}
00035         self.virtMax = 0
00036         self.virtMin = 999
00037         self.resMax = 0
00038         self.resMin = 999
00039 
00040         return SUCCESS

def MemoryCheck::checkMemory::execute (   self)

Definition at line 41 of file __init__.py.

00042                      :
00043         if self.execNumber % 1000 == 0:
00044             print "------- Check Memory, excute: ", self.execNumber
00045         else:
00046             self.execNumber = self.execNumber + 1
00047             return SUCCESS
00048 
00049         # Use system command to record memory use
00050         #  Have to deal with fact that in linux, this generates a single line,
00051         # while on mac, the header line is also generated.
00052         procid = str(os.getpid())
00053         ps = 'ps uh ' + procid
00054         blob = commands.getoutput(ps)
00055         lines = blob.split('\n')
00056         word = None
00057         for line in lines:
00058             if procid in line :
00059                 word = line.split()
00060                 break
00061 
00062         # check that line manipulation was successful
00063         if word is None:
00064             if self.execNumber == 0 :
00065                 print "MemoryCheck: ERROR No memory checking applied"
00066                 print "MemoryCheck: ERROR Could not find procid",procid,"in",lines
00067         else:
00068             self.virt[self.execNumber] = float(word[4])/(1024.*1024.)
00069             self.res[self.execNumber] = float(word[5])/(1024.*1024.)
00070 
00071             # Find maximum and minimum memory use
00072             if self.virtMax < self.virt[self.execNumber]:
00073                 self.virtMax = self.virt[self.execNumber]
00074             if self.virtMin > self.virt[self.execNumber]:
00075                 self.virtMin = self.virt[self.execNumber]
00076 
00077             if self.resMax < self.res[self.execNumber]:
00078                 self.resMax = self.res[self.execNumber]
00079             if self.resMin > self.res[self.execNumber]:
00080                 self.resMin = self.res[self.execNumber]
00081 
00082         self.execNumber = self.execNumber + 1
00083 
00084         return SUCCESS

def MemoryCheck::checkMemory::finalize (   self)

Definition at line 85 of file __init__.py.

00086                       :
00087 
00088         self.histSvc = self.svc('ITHistSvc', 'THistSvc')
00089         self.hist = {}
00090 
00091         # Define histogram for virtual and resident memory
00092         self.hist["virt"] = gbl.TH2F("virt", "Virtual Memory",
00093             self.execNumber + 1, 0., self.execNumber, 
00094             100, self.virtMin*0.95, self.virtMax*1.05)
00095         status = self.histSvc.regHist('/fileMemory/virt', 
00096             self.hist["virt"])
00097         if status.isFailure(): return status
00098 
00099         self.hist["res"] = gbl.TH2F("res", "Resident Memory",
00100             self.execNumber + 1, 0., self.execNumber, 
00101             100, self.resMin*0.95, self.resMax*1.05)
00102         status = self.histSvc.regHist('/fileMemory/res', 
00103             self.hist["res"])
00104         if status.isFailure(): return status
00105 
00106         # Fill histogram
00107         for i in self.virt:
00108             self.hist["virt"].Fill(float(i),self.virt[i])
00109         for i in self.res:
00110             self.hist["res"].Fill(float(i),self.res[i])
00111 
00112         print "Finalizing ", self.name()
00113         print "Max resident memory is %s GByte" % self.resMax
00114         print "Max virtual memory is %s GByte" % self.virtMax
00115         status = GaudiAlgo.finalize(self)
00116         return status


Member Data Documentation

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 25 of file __init__.py.

Definition at line 85 of file __init__.py.

Definition at line 85 of file __init__.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:12 for MemoryCheck by doxygen 1.7.4