If you’ve ever wondered how much memory a process uses, you’ve probably used a form of task manager or system monitor. System monitors can be useful to identify resource hogs, but are often less versatile if you want more details about just one process. If you’ve ever faced this problem, then [Fabien Sanglard]’s Space-Time explorer is for you!

The wonderfully punny Space-Time tool records physical memory usage, time spent in user space vs. kernel space and even threads and subprocesses created. These words may not mean much to some readers, so let’s quickly go over them: Physical memory usage is the actual amount of RAM given (not always the same as requested). The kernel (which lives in kernel space) is the supervisor to all processes on a computer. In contrast, every process lives in it’s own “user space”, a way of protecting the kernel. Finally, a subprocess (or “child process”) is simply a process started by another process (the “parent”).

In their blog post, [Fabien] starts with a simple test program: allocating 1 GiB and setting each byte individually. What would seem like a simple task that shouldn’t take much more than 10ms actually takes over a second and [Fabien] explains that the kernel doesn’t actually immediately give 1 GiB, but actually waits until the memory gets used. [Fabien] also compares the Space-Time footprints of hello world programs in C and C++ (both clang and GCC), Rust, Java and Go, which yields surprising results. [Fabien] also tries some more “real-world” tasks like a browser (chromium), curl, wget and even a compiling a “medium-size” project (Git) from source. Finally, [Fabien] finishes off by briefly explaining how Space-Time explorer works and why what pushed them to create the tool in the first place.

If you’re looking to improve you Linux arsenal, how about building a better ls?

Source: https://hackaday.com/2023/09/27/explore-linux-space-time/