Issue 256 in psutil: Rename psutil.virtmem_usage() to psutil.swapmem_usage()

0 views
Skip to first unread message

psu...@googlecode.com

unread,
Mar 5, 2012, 7:38:08 PM3/5/12
to psutil-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium Compatibility

New issue 256 by g.rodola: Rename psutil.virtmem_usage() to
psutil.swapmem_usage()
http://code.google.com/p/psutil/issues/detail?id=256

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.

psu...@googlecode.com

unread,
Mar 17, 2012, 10:07:13 AM3/17/12
to psutil-...@googlegroups.com

Comment #1 on issue 256 by noxda...@gmail.com: Rename
psutil.virtmem_usage() to psutil.swapmem_usage()
http://code.google.com/p/psutil/issues/detail?id=256

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.

psu...@googlecode.com

unread,
Jul 24, 2012, 2:31:27 PM7/24/12
to psutil-...@googlegroups.com
Updates:
Status: Duplicate
Labels: Usability
Mergedinto: 311

Comment #2 on issue 256 by g.rodola: Rename psutil.virtmem_usage() to
psutil.swapmem_usage()
http://code.google.com/p/psutil/issues/detail?id=256

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.

Reply all
Reply to author
Forward
0 new messages