5 print('psutil available')
12 self
.memstats_available
= False
14 self
.process
=psutil
.Process()
15 self
.memstats_available
= True
19 self
.lasttime
= self
._gettime
()
20 self
.lastmem
= self
._getmem
()
21 self
.basemem
= self
.lastmem
26 """return the time in seconds used by the current process."""
28 m
=self
.process
.get_cpu_times()
29 return m
.user
+ m
.system
33 """return the resident set size in bytes used by the current process."""
35 m
= self
.process
.get_memory_info()
40 """return the time since the last call in seconds used by the current process."""
42 self
.lasttime
= self
._gettime
()
43 self
.elapsedtime
= self
.lasttime
- old
44 return self
.elapsedtime
47 """return the maximum resident set size since the first call in bytes used by the current process."""
48 self
.lastmem
= self
._getmem
()
49 d
= self
.lastmem
- self
.basemem