1
0
Fork
You've already forked swapusage
0
Shows the amount of swapped memory for every process.
  • C++ 84.4%
  • Makefile 8.2%
  • C 7.4%
Find a file
2015年05月08日 14:33:11 +02:00
.cproject add eclipse files 2014年06月12日 23:47:30 +02:00
.gitignore more ignores 2014年06月12日 23:48:03 +02:00
.project add eclipse files 2014年06月12日 23:47:30 +02:00
LICENSE Initial commit 2014年06月12日 18:48:13 +02:00
Makefile Move to C++14, use unique_ptr 2015年05月08日 14:33:11 +02:00
pid.cpp use plain char* instead of string 2015年03月13日 17:42:15 +01:00
pid.h use plain char* instead of string 2015年03月13日 17:42:15 +01:00
process.cpp Move to C++14, use unique_ptr 2015年05月08日 14:33:11 +02:00
process.h Move to C++14, use unique_ptr 2015年05月08日 14:33:11 +02:00
README.md Move to C++14, use unique_ptr 2015年05月08日 14:33:11 +02:00
swap.cpp clean up filename handling 2014年12月11日 23:16:09 +01:00
swap.h hide constant definitions, reorg headers, less copying 2014年11月25日 17:35:09 +01:00
swapusage.cpp Move to C++14, use unique_ptr 2015年05月08日 14:33:11 +02:00

swapusage

About

This little utility for Linux shows the amount of swapped memory for running processes.

Contrary to popular belief this is actually not that easy, and tools like top either don't do this at all, or completely wrong; see this discussion on StackOverflow for some background.

After finding some of the proposed scripts unacceptably inefficient, I decided to write my own in C++.

Requirements

  • Compiler with C++14 support
  • Linux :)

Installation

  • Type "make" & copy the executable wherever you want.
  • If you encounter any problems then please fix them and send a pull request. :)

Gentoo users can find an ebuild in my overlay.

Usage

$./swapusage -h
Usage: swapusage [pid]
$./swapusage
====================================
 Swap kB PID Name
====================================
 976 5531 pulseaudio
 292 2738 zsh
 64 5239 gam_server
------------------------------------
 1332 kB total.
$./swapusage 5531
====================================
 Swap kB PID Name
====================================
 976 5531 pulseaudio

More information

While swapusage is a good first step towards analyzing a swap (and memory) situation, you might find that you need much more detailed analysis capabilities. In that case you could look at smem.