Fix T63982: A.N.T. Landscape add-on broken after psutil API change
Differential Revision: https://developer.blender.org/D4759
This commit is contained in:
parent
7274975940
commit
89568c1a42
Notes:
blender-bot
2023-02-14 19:16:34 +01:00
Referenced by issue #63982, A.N.T Landscape add-on broken after psutil API change
|
@ -25,14 +25,22 @@ class Stats:
|
|||
def _gettime(self):
|
||||
"""return the time in seconds used by the current process."""
|
||||
if psutil_available:
|
||||
m=self.process.get_cpu_times()
|
||||
""" Handle psutil API change. """
|
||||
if hasattr(self.process, "get_cpu_times"):
|
||||
m = self.process.get_cpu_times()
|
||||
else:
|
||||
m = self.process.cpu_times()
|
||||
return m.user + m.system
|
||||
return time()
|
||||
|
||||
def _getmem(self):
|
||||
"""return the resident set size in bytes used by the current process."""
|
||||
if psutil_available:
|
||||
m = self.process.get_memory_info()
|
||||
""" Handle psutil API change. """
|
||||
if hasattr(self.process, "get_memory_info"):
|
||||
m = self.process.get_memory_info()
|
||||
else:
|
||||
m = self.process.memory_info()
|
||||
return m.rss
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue