• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 12 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

core memory & swap reporting

psm - simple, accurate memory reporting for Linux

psm makes it easy to see who is resident in memory, and who is significantly swapped out.

psm is based off the ideas and implementation of ps_mem.py. It requires root privileges to run. It is implemented in go, and since the executable is a binary it can be made setuid root so that unprivileged users can get a quick overview of the current memory situation.

installation

If you're familiar with go and have the go toolchain installed, installation is as easy as:

go get github.com/bpowers/psm
sudo `which psm`

The sudo `which psm` can get a bit tiring. If you're on Ubuntu, there is a PPA which install psm as setuid root:

sudo apt-get install python-software-properties # for apt-add-repository
sudo add-apt-repository ppa:bobbypowers/psm
sudo apt-get update
sudo apt-get install psm

example output

bpowers@python-worker-01:~$ psm -filter=celery
    MB RAM    SHARED   SWAPPED	PROCESS (COUNT)
      60.6       1.1     134.2	[celeryd@notifications:MainProcess] (1)
      62.6       1.1          	[celeryd@health:MainProcess] (1)
     113.7       1.2          	[celeryd@uploads:MainProcess] (1)
     155.1       1.1          	[celeryd@triggers:MainProcess] (1)
     176.7       1.2          	[celeryd@updates:MainProcess] (1)
     502.9       1.2          	[celeryd@lookbacks:MainProcess] (1)
     623.8       1.2      28.5	[celeryd@stats:MainProcess] (1)
     671.3       1.2          	[celeryd@default:MainProcess] (1)
#   2366.7               164.7	TOTAL USED BY PROCESSES

The MB RAM column is the sum of the Pss value of each mapping in /proc/$PID/smaps for each process.

TODO

  • port to the BSDs and OS X
  • FreeBSD has a Linux-compatable procfs impelmentation, which would be trivial to use (and, indeed, ps_mem.py uses it).
  • OS X looks... fun. MacFUSE provides a lot of the info we need, but I don't want to depend on having that installed and manually having their procfs mounted. There are Mach functions we could use, but I'm having trouble figuring out how to correctly pass data between go and C. Specifically: https://gist.github.com/4463209 - 'patches welcome'.
  • ps_mem.py records the md5sum of each process's smaps entry to make sure that we're not double-counting. Its probably worth doing.

license

psm is offered under the MIT license, see LICENSE for details.

More Repositories

1

simlin

system dynamics modeling
Rust
71
star
2

sd.js

sd.js is now https://simlin.com
55
star
3

seshcookie

http sessions stored in encrypted cookies for Go
Go
51
star
4

btscale

javascript library to talk to bluetooth scales, like the acaia.
JavaScript
43
star
5

mstat

fine-grained, cgroup-based tool for profiling memory usage over time of a process tree
Go
42
star
6

gocalc

goyacc calculator example
Shell
22
star
7

liquid-types

Logically Qualified Data Types - automatically infer refinement types
Rust
15
star
8

rust-envoy-control-plane

Envoy xDS APIs for Rust
Rust
10
star
9

judyarrays

clone of the canonical svn repo
C
10
star
10

ortools

Go wrapper for Google's ortools
C++
10
star
11

bit

big immutable table
Go
9
star
12

cnote

personal music service
C
9
star
13

musl

C
7
star
14

Raft.NET

C#
6
star
15

goembed

Raspberry Pi development in Go
Go
6
star
16

caps

Linux capabilities for go
Go
6
star
17

mule-proxy

fast proxy: eBPF data plane, Go control plane
Go
6
star
18

radix

Asynchronous Redis client for Go
Go
6
star
19

resvg-wasm

Rust
3
star
20

goroast

coffee roasting in go
Go
3
star
21

browsix.org

TeX
3
star
22

boosd

language
Go
3
star
23

slm

this was a huge mistake
C
3
star
24

wasm-crt1

description of crt1 work for WebAssembly + Emscripten + Browsix
C
3
star
25

slackfs

Go
3
star
26

go-django

utilities for interacting with Django-related data
Go
3
star
27

liballoc_hoard

use Hoard as rust's allocator
Rust
3
star
28

node-priority

getpriority(2) and setpriority(2) for node
C++
3
star
29

lightswitchrave

music player
CSS
3
star
30

go-tmux

Go
2
star
31

ronvoy

just a hobby, won't be big and professional like Envoy
Rust
2
star
32

sdjs-example

Python
2
star
33

go-xmile

Go implementation of the XMILE system dynamics standard.
Go
2
star
34

verified-jit

OCaml
2
star
35

psm2

psm - rewritten in C with a reduced memory footprint
C
2
star
36

xmutil-rs

bob's xmutil as a rust library with no external dependencies
Rust
1
star
37

msgsig

Go
1
star
38

node-binary-marshal

TypeScript
1
star
39

pstore-sort

sort + filter EFI pstore logs
Go
1
star
40

clf

Python
1
star
41

godocr

godoc for remote repositories
Go
1
star
42

libralloc

malloc/free for C/C++ written in Rust
Rust
1
star
43

opensim

a Sugar activity for system dynamics modeling
Python
1
star
44

protected-service

Go
1
star
45

hal-test

an example of how to write good code that calls into HAL
C
1
star
46

seshcookie-js

Encrypted cookie-based sessions for Express
TypeScript
1
star
47

lockfree-rate

lockfree implementation of Go's rate.Limiter
Go
1
star
48

node-pipe2

exposes the pipe2 system call for building unix pipelines/filters
C++
1
star