Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
How to monitor memory usage within Python? (Linux
kj
2/24/2010 10:36:00 PM
Is there some standard module for getting info about the process's
memory usage, in a Linux/Unix system?
(I want to avoid hacks that involve, e.g., scraping ps's output.)
Thanks!
~K
3 Answers
Diez B. Roggisch
2/24/2010 10:49:00 PM
0
Am 24.02.10 23:35, schrieb kj:
> Is there some standard module for getting info about the process's
> memory usage, in a Linux/Unix system?
>
> (I want to avoid hacks that involve, e.g., scraping ps's output.)
http://code.google.com/...
Diez
MrJean1
2/25/2010 1:27:00 AM
0
For Linux only
<
http://code.activestate.com/recipes/2...
/Jean
On Feb 24, 2:35 pm, kj <no.em...@please.post> wrote:
> Is there some standard module for getting info about the process's
> memory usage, in a Linux/Unix system?
>
> (I want to avoid hacks that involve, e.g., scraping ps's output.)
>
> Thanks!
>
> ~K
Giampaolo Rodola'
2/25/2010 1:15:00 PM
0
On 24 Feb, 23:35, kj <no.em...@please.post> wrote:
> Is there some standard module for getting info about the process's
> memory usage, in a Linux/Unix system?
>
> (I want to avoid hacks that involve, e.g., scraping ps's output.)
>
> Thanks!
>
> ~K
http://code.google.co...
>>> import psutil
>>> p = psutil.Process(7055)
>>> p.cmdline
['/usr/bin/python']
>>> rss, vms = p.get_memory_info()
>>> "Resident memory: %s KB" %(rss / 1024)
'Resident memory: 3768 KB'
>>> "Virtual memory: %s KB" %(vms / 1024)
'Virtual memory: 6176 KB'
>>> p.get_memory_percent()
0.8342
--- Giampaolo
http://code.google.com/p/...
http://code.google.co...
/
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
How to monitor memory usage within Python? (Linux
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password