10

baobab / "Gnome Disk Usage Analyzer" is my favorite way to visualize disk usage -- I'm not sure what the type of graph this is, but it makes sense to me -- diving deep into folders gets more detailed breakdown of the main "slice".

Memory in the "Activity Monitor" or htop, or any other tools I've known, is exceptionally hard to figure out how memory is being used -- because so many programs spawn sub-processes, threads, etc -- it kinda makes sense that a baobab-style graph for memory would bring sense to the madness that is memory usage representation.

Does anything like this exist?


Update!

I learned that the chart is roguhly a "Sunburst Chart". Example: https://observablehq.com/@d3/sunburst

After seeing smem (and all the dependencies needed to install it), I'm considering making what I want . If one doesn't exist, it doesn't seem too hard -- at least for the jank way I was thinking of implementing it, which is:

  • already have Node of some kind on your machine (I'm a JS dev, so I already have node)
  • boot up a light-weight server in node with a http server and websocket endpoint for live data
  • serve some pre-built static assets to a web browser to render the sunburst chart.

Update 2

Progress: enter image description here

Update 3

Progress -- I dropped support for windows and mac so I could get a 1s refresh rate (I could probably do faster, but why bother?)

enter image description here

  • Will your progress seen in update 2 be available for pleb access? – BaTycoon Sep 14 '22 at 14:22
  • 2
    yeah, I have an npm package at pnpx ram-usage-analyzer (provided you have node 16 + pnpm installed), It's super early tho -- buggy not performant (yet), no config (yet), awkward ux (for now!) -- kinda getting my bearings around d3 atm.

    I'm also debating dropping support for windows and macos, so I can just read from /proc directly (for perf reasons)

    – NullVoxPopuli Sep 14 '22 at 20:03
  • 1
    v 0.0.4 should be the first "working" version – NullVoxPopuli Sep 14 '22 at 20:12
  • smallest I've been able to get it so far is 32MB (size of all dependencies, excluding node) – NullVoxPopuli Sep 15 '22 at 02:36
  • tho, https://bundlejs.com/?q=ram-usage-analyzer implies < 1MB... – NullVoxPopuli Sep 15 '22 at 02:42

1 Answers1

7

Smem sudo apt-get install smem

Besides a command line list of processes (similar to top/htop but without a summary at the top).

sudo smem

it lists it like this:

  676 root     /usr/lib/snapd/snapd               0    28380    28410    30320 
  300 root     /lib/systemd/systemd-journa        0    26932    30747    39896 
63297 rinzwind /opt/google/chrome/chrome -        0    24296    31125   138532 
63203 rinzwind /opt/google/chrome/chrome -        0    26884    32797   135664 
62813 rinzwind /opt/google/chrome/chrome -        0    27808    35084   143680 
62833 rinzwind /opt/google/chrome/chrome -        0    28668    36777   146864 
63364 rinzwind /usr/bin/tilix --gapplicati        0    35132    38137    74620 

But it also supports graphs with a couple of commands and parameters:

command  process command line
maps     total number of mappings
name     name of process
pid      process ID
pss      proportional set size (including sharing)
rss      resident set size (ignoring sharing)
swap     amount of swap space consumed (ignoring sharing)
user     owner of process
uss      unique set size
vss      virtual set size (total virtual memory mapped)

Example:

sudo smem --pie name -c "pss"

enter image description here

Or

sudo smem --bar name -c "pss uss" -U rinzwind

enter image description here

Rinzwind
  • 299,756
  • woah there, smem is 425MB (with all the other stuff I don't have on my system). that seems intense. looks like it wants to install a bunch of python and javascript libraries.. more fonts, some c++ stuff -- is there anything... lighter weight? – NullVoxPopuli Sep 10 '22 at 23:01
  • @NullVoxPopuli not that I know off. All the others are only command line and not graphical. There is a reason why top and htop are admin favourites ;-) – Rinzwind Sep 10 '22 at 23:25
  • @NullVoxPopuli 425MB is not that intense, is it? With a moderately sized disk of 250GB this is only 0.2% of the total space. – Marijn Sep 11 '22 at 14:58
  • sure, but why settle for that when I can have the same thing in potentially under 1 MB? and have better graphics (I'm making an alternative tool) – NullVoxPopuli Sep 11 '22 at 14:59