Skip to content

Commit

Permalink
Stats app : Replace Windows subprocess with psutil
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Dec 6, 2023
1 parent 358b7b5 commit ef57c63
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/stats/stats-1.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
if sys.platform != "win32":
import resource
else:
import subprocess
import psutil

import IECore

Expand Down Expand Up @@ -746,8 +746,7 @@ def maxRSS( cls ) :
if sys.platform == "darwin" :
return cls( resource.getrusage( resource.RUSAGE_SELF ).ru_maxrss )
elif sys.platform == "win32" :
result = subprocess.check_output( ["wmic", "process", "where", "processid={}".format(os.getpid()), "get", "PeakWorkingSetSize"] )
return cls( int( result.split()[1] ) * 1024 )
return cls( psutil.Process().memory_info().peak_wset )
else :
return cls( resource.getrusage( resource.RUSAGE_SELF ).ru_maxrss * 1024 )

Expand Down

0 comments on commit ef57c63

Please sign in to comment.