[Python] ANN: psutil 0.6.0 released
Giampaolo Rodolà
g.rodola a gmail.com
Lun 13 Ago 2012 16:08:22 CEST
Hi folks,
I'm pleased to announce the 0.6.0 release of psutil:
http://code.google.com/p/psutil/
This is one of the best releases so far as it addresses two important
issues: system memory functions management and permission errors
occurring on Windows and OSX.
=== Memory functions ===
psutil.phymem_usage() and psutil.virtmem_usage() are deprecated.
Instead we now have psutil.virtual_memory() and psutil.swap_memory(),
which should provide all the necessary pieces to monitor the actual
system memory usage, both physical and swap/disk related.
The refactoring was modeled after Zabbix, see:
http://code.google.com/p/psutil/issues/detail?id=311
http://blog.zabbix.com/when-alexei-isnt-looking/#vm.memory.size
http://www.zabbix.com/documentation/2.0/manual/appendix/items/vm.memory.size_params
If you don't want to read how and why I did that, the bottom line is:
if you want to monitor actual system memory usage in a cross platform
fashion use:
>>> psutil.virtual_memory().available
=== No more AccessDenied exceptions when querying processes ===
On Windows and OSX the Process methods below were always raising AccessDenied
for any process owned by another user:
OSX
- name
- get_memory_info()
- get_memory_percent()
- get_cpu_times()
- get_cpu_percent()
- get_num_threads()
WINDOWS
- create_time
- get_children()
- get_cpu_times()
- get_cpu_percent()
- get_memory_info()
- get_memory_percent()
- get_num_handles()
- get_io_counters()
Especially on OSX this made psutil basically unusable as a limited
user, even for determining basic process information such as CPU
percent or memory usage.
Now this is no longer the case.
For further details see:
http://code.google.com/p/psutil/issues/detail?id=297
http://code.google.com/p/psutil/issues/detail?id=303
=== Other major enhancements ===
- per-process extended memory stats.
- per-process number of voluntary and involuntary context switches.
- per-process connections: added UNIX sockets support.
- (BSD) Process.get_connections() rewritten in C and no longer requiring lsof.
- (OSX) added support for process cwd
- psutil.network_io_counters() now provides the number of in/out
packets dropped and with errors.
- new example scripts:
example/meminfo.py
example/free.py
example/netstat.py
example/pmap.py
=== New features by example ===
>>> import psutil, os
>>> p = psutil.Process(os.getpid())
>>>
>>> p.get_num_ctx_switches()
amount(voluntary=78, involuntary=19)
>>>
>>> p.get_ext_memory_info()
meminfo(rss=9662464, vms=49192960, shared=3612672, text=2564096,
lib=0, data=5754880, dirty=0)
>>>
>>> p.get_connections(kind='unix')
[connection(fd=8, family=1, type=1,
local_address='/tmp/unix_socket.sock', remote_address=None,
status='')]
>>>
>>>
>>> psutil.virtual_memory()
vmem(total=8374149120L, available=2081050624L, percent=75.1,
used=8074080256L, free=300068864L, active=3294920704,
inactive=1361616896, buffers=529895424L, cached=1251086336)
>>>
>>> psutil.swap_memory()
swap(total=2097147904L, used=296128512L, free=1801019392L,
percent=14.1, sin=304193536, sout=677842944)
>>>
=== Compatitility notes ===
0.6.0 version does not introduce any backward incompatibility.
Nevertheless it introduces some deprecations warnings:
- psutil.phymem_usage() is deprecated in favor of psutil.virtual_memory()
- psutil.virmem_usage() is deprecated in favor of psutil.swap_memory()
- psutil.cached_phymem() is deprecated in favor of
psutil.virtual_memory().cached
- psutil.phymem_buffers() is deprecated in favor of
psutil.virtual_memory().buffers
The deprecated functions will be removed in next 1.0.0 version.
=== Links ===
* Home page: http://code.google.com/p/psutil
* Source tarball: http://psutil.googlecode.com/files/psutil-0.6.0.tar.gz
* Api Reference: http://code.google.com/p/psutil/wiki/Documentation
Please try out this new release and let me know if you experience any
problem by filing issues on the bug tracker.
Thanks in advance.
--- Giampaolo Rodola'
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/
http://code.google.com/p/pysendfile/
Maggiori informazioni sulla lista
Python