Sembra interessante. Grazie per la segnalazione Mario
Inviato da iPhone Il giorno 21/mar/2011, alle ore 13:46, Giampaolo Rodolà <g.rod...@gmail.com> ha scritto: > Salute a tutti, > sono lieto di annunciare il rilascio della versione 0.2.1 di psutil: > http://code.google.com/p/psutil > > === About === > > psutil è un modulo che permette di ottenere informazioni riguardo i > processi in esecuzione e il sistema operativo (CPU, memoria) tramite > Python, implementando diverse funzionalità offerte da tools da linea > di comando quali ps, top, lsof e netstat. > psutil supporta Linux, Windows, OS X e FreeBSD, sia 32-bit che 64-bit, > su Python da 2.4 a 3.2 utilizzando un'unica code-base. > > === Nuove features === > > * process I/O counters > * process wait() (aspetta che un processo termini e ritorna l'exit code) > * process get_threads() informazioni (id, user and kernel times) > riguardo i thread aperti dal processo > * process uids/gids (saved, real e effective) > * process "niceness" (priorità, get e set) > * stato dei processi (running, stopped etc...) > * process I/O "niceness" (priorità I/O) > * psutil.Popen, una nuova classe che offre un'interfaccia più > conveniente di subprocess.Popen > > === Esempio delle nuove features === > >>>> p = psutil.Process(7055) >>>> p.name > 'python' >>>> >>>> str(p.status) > 'running' >>>> >>>> p.uids > user(real=1000, effective=1000, saved=1000) >>>> p.gids > group(real=1000, effective=1000, saved=1000) >>>> >>>> p.nice > 0 >>>> p.nice = 10 # cambia priorità >>>> p.nice > 10 >>>> >>>> p.get_ionice() > ionice(ioclass=0, value=0) >>>> p.set_ionice(psutil.IOPRIO_CLASS_IDLE) # cambia priorità I/O >>>> p.get_ionice() > ionice(ioclass=3, value=0) >>>> >>>> p.get_io_counters() > io(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632) >>>> >>>> p.get_threads() > [thread(id=5234, user_time=22.5, system_time=9.2891), > thread(id=5235, user_time=0.0, system_time=0.0), > thread(id=5236, user_time=0.0, system_time=0.0), > thread(id=5237, user_time=0.0707, system_time=1.2)] >>>> >>>> p.terminate() >>>> p.wait(timeout=3) > 0 >>>> > > > = psutil.Popen = > >>>> import psutil >>>> from subprocess import PIPE >>>> p = psutil.Popen(["/usr/bin/python", "-c", "print 'hi'"], stdout=PIPE) >>>> p.name > 'python' >>>> p.uids > user(real=1000, effective=1000, saved=1000) >>>> p.username > 'giampaolo' >>>> p.communicate() > ('hi\n', None) >>>> p.terminate() >>>> p.wait(timeout=2) > 0 >>>> > > > === Links === > > * Home page: http://code.google.com/p/psutil > * Mailing list: http://groups.google.com/group/psutil/topics > * Sorgenti: http://psutil.googlecode.com/files/psutil-0.2.1.tar.gz > * Documentazione: http://code.google.com/p/psutil/wiki/Documentation > > > --- Giampaolo Rodola' > > http://code.google.com/p/pyftpdlib > http://code.google.com/p/psutil/ > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python