cw-oldrepos / psutil

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

Rename psutil.virtmem_usage() to psutil.swapmem_usage() #256

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
https://groups.google.com/forum/?fromgroups#!topic/psutil/IT1uaMcIVTs
virtmem_usage() should be turned into an alias raising a DeprecationWarning.

We just need to make sure the name will be consistent across all platforms 
meaning we have to be 100% sure we're currently providing swap memory 
information.
This might sound silly but it's a long time I don't take a look at the 
memory-related functions.

Original issue reported on code.google.com by g.rodola on 6 Mar 2012 at 12:37

GoogleCodeExporter commented 9 years ago
In "Operating System Concepts, Silberschatz - Galvin - Gagne" the disk memory 
is defined Backing Store Memory; this is the current mostly used academical 
definition.

Others prefer to call it "Disk cache", this is wrong as the term is related to 
the disk cache buffer and sometimes (also wrongly) to the RAMdisk.

So i suggest something like:
psutil.backmem_usage()
or
psutil.backing_usage()
or
psutil.backstore_usage()

I was guessing: wouldn't be easier to introduce a class? This could help in 
obtaining a more structured portability.

mem = psutil.Memory()

In Windows:
mem.pagefile_usage
In Linux:
mem.swapfile_usage
Cross-platform:
mem.backstore_usage()

Developer may choose wheter to use the attribute bound to the OS he's 
developing on or the more expensive (due to cross-platform adaptation) method. 
This would sligthly help performance too.

Original comment by noxda...@gmail.com on 17 Mar 2012 at 2:06

GoogleCodeExporter commented 9 years ago
As for the function name: I think swap_memory() is just fine.
"backing store memory" is something most people never heard of (me included).
"swap", on the other hand, is a well established term which, erroneously or 
not, is also used in a lot of cmdline tools and graphical task managers on both 
Windows and UNIX. First examples coming to mind are 'free', 'top' and 'htop' 
cmdline tools.

Renamed into swap_memory() as of r1476 and also provided swapin/swapout 
counters (r1479, r1480, r1481).
Merging into issue 311. Please let's continue discussion there.

Original comment by g.rodola on 24 Jul 2012 at 6:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r1476 == revision 0f65219565d2

Original comment by g.rodola on 2 Mar 2013 at 12:07