nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

psutil.virtmem_usage() returning 0 fro usgae #190

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using ubuntu 10.04 server and psutil (0.3.0)
2. run psutil.virtmem_usage() from python interpreter

What is the expected output? What do you see instead?
this is the result from virtmem_usage()
usage(total=24379383808, used=0, free=24379383808, percent=0.0)

however when I run free I get

             total       used       free     shared    buffers     cached
Mem:          7936       5556       2380          0         90       4896
-/+ buffers/cache:        569       7367
Swap:        23249          0      23249

In the doctrings for virtmem_usage it says it should output the same as free. 
So why is my usage 0?

What version of psutil are you using? What Python version?
psutil (0.3.0)
python 2.6.5

On what operating system? Is it 32bit or 64bit version?

Linux db1 2.6.32-32-server #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 x86_64 
GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by ma...@iconiq.com.au on 28 Jul 2011 at 8:51

GoogleCodeExporter commented 8 years ago
Because psutil return results expressed in bytes while "free" uses kilo bytes.
Try:

>>>  psutil.virtmem_usage().total / 1024

...and you'll see it's the same as free.
Please, next time use the mailing list.

Closing out as invalid.

Original comment by g.rodola on 28 Jul 2011 at 8:55