import KernelBasis
KernelBasis.StopMonitoring(monitoringInfo.pid)
+def ReadCPUMemInfoInternal( fileName ):
+ import KernelBasis
+ ret = KernelBasis.ReadFloatsInFile( fileName )
+ cpu = ret[::2]
+ mem_rss = [ int(elt) for elt in ret[1::2]]
+ return [(a,b) for a,b in zip(cpu,mem_rss)]
+
def ReadCPUMemInfo( monitoringInfo ):
"""
Retrieve CPU/Mem data of monitoring.
-------
list<float,str> : list of pairs. First param of pair is CPU usage. Second param of pair is rss memory usage
"""
- import KernelBasis
- ret = KernelBasis.ReadFloatsInFile( monitoringInfo.outFileName.filename )
- cpu = ret[::2]
- mem_rss = [ int(elt) for elt in ret[1::2]]
- return [(a,b) for a,b in zip(cpu,mem_rss)]
+ return ReadCPUMemInfoInternal( monitoringInfo.outFileName.filename )
+
+def ReadInodeSizeInfoInternal( fileName ):
+ import datetime
+ with open(fileName, "r") as f:
+ coarseData = [ elt.strip() for elt in f.readlines() ]
+ tss = [ datetime.datetime.fromtimestamp( float(elt) ) for elt in coarseData[::3] ]
+ nbInodes = [int(elt) for elt in coarseData[1::3]]
+ volumeOfDir = coarseData[2::3]
+ return [(t,a,b) for t,a,b in zip(tss,nbInodes,volumeOfDir)]
def ReadInodeSizeInfo( monitoringInfo ):
"""
Second param of triplet is #inodes.
Thirst param of triplet is size.
"""
- import datetime
- with open(monitoringInfo.outFileName.filename, "r") as f:
- coarseData = [ elt.strip() for elt in f.readlines() ]
- tss = [ datetime.datetime.fromtimestamp( float(elt) ) for elt in coarseData[::3] ]
- nbInodes = [int(elt) for elt in coarseData[1::3]]
- volumeOfDir = coarseData[2::3]
- return [(t,a,b) for t,a,b in zip(tss,nbInodes,volumeOfDir)]
+ return ReadInodeSizeInfoInternal( monitoringInfo.outFileName.filename )
class SeqByteReceiver:
# 2GB limit to trigger split into chunks