Rilasciata psutil (Python process and system utilities) 0.3.0

 Tra le varie migliorie

  • utilizzo disco
  • listing delle partizioni di sistema
  • percentuale di utilizzo per-CPU

Un po' di codice...
>>> import psutil
>>>
>>> for x in range(3):
...     psutil.cpu_percent(percpu=True)
... 
[4.0, 34.2]
[7.0, 8.5]
[1.2, 9.0]
>>>
>>> psutil.phymem_usage()
usage(total=4153868288, used=2854199296, free=1299668992, percent=34.6)
>>> psutil.virtmem_usage()
usage(total=2097147904, used=4096, free=2097143808, percent=0.0)
>>>
>>> psutil.get_partitions()
[partition(device='/dev/sda3', mountpoint='/', fstype='ext4'),
 partition(device='/dev/sda7', mountpoint='/home', fstype='ext4')]
>>>
>>> psutil.disk_usage('/')
usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)
>>>
>>>
>>> psutil.Process(os.getpid()).terminal
'/dev/pts/0'
 
Links

 

Il tuo voto: Nessuno Media voti: 3 (1 voto)