I'd like to test a few window managers to see which of them takes less memory and CPU in certain time period (so is better choice for older computers). I'd like to make the tests myself (not to read a review).

Which application for testing would you use to have precise results? How would you use it?

2 Answers
2

Following KISS principle, I'd just monitor free memory with free -m trying to run the same set of user apps for the same period of time. Just keep in mind, that 'cached' is actually free memory as well, so you need the 2nd line which shows what real used and free memory volumes are.

Regarding CPU — WMs usually don't hog CPU by themselves — they do that reacting to some user's actions, so you can benchmark creating/deleting lots of windows, moving them and so on.

free -m will allow you to check how much the overal RAM usage fluctuates on your system. However, to monitor the memory and CPU usage of a particular process, I would recommend top (or htop) and ps.

With htop, you can monitor the RES column of a process to get an accurate estimation of how much physical memory space is taken by running the application (it does not count unused parts of shared libraries, for example).

(h)top is great if you want to see real-time (or very nearly) updates of the process's resource usage, but it's rather hard to parse and collate for data. As a result, if you want to collect data for analysis at a later time, I would recommend the use of ps.

For example, using the following, you should be able to monitor a particular process rather efficiently:

$ watch "ps aux | grep -e name-of-process -e USER"

The above will show you the column headings (because of -e USER) and update the statistics for the matching processes every two seconds. Similarly to htop, the RSS column is the resident size of the program.