Memory Footprint Measurement Methodology

The following tools will be used to capture memory usage information:

  • smemcap

  • xrestop

Usage information will be captured at the following times:

  • boot completion
  • graphical login completion

Because "boot completion" and "login completion" don't have an obvious definition, it is necessary to impose definitions for these points in time so that measurements can be made in a consistent way.

smemcap

smemcap simply outputs a tar file on stdout containing /proc/meminfo and detailed process memory usage information from /proc/pid/.

For capture purposes, it can be invoked like this:

smemcap | gzip >smemcap.tar.gz

smemcap is available from the smemcap package.

xrestop

xrestop reports resource usage in the X server using the X-Resource server extension.

This tool runs interactively by default, but also has a batch mode. To generate a single resource usage report in formatted text on standard output, the tool can be invoked as follows:

xrestop --batch --max-samples 1 >xres.txt

Some X clients do not declare their name and PID by setting the appropriate window properties. If this proves to be a problem, it should be feasible to wrap libX11/libxcb/libX11-xcb window creation calls to set the WM_NAME and _NET_WM_PID properties to sane values on window creation. See:

xrestop is available from the xrestop package.

Boot completion

Boot completion is defined as the time init finishes running scripts to enter runlevel 2 and plymouth (if present) has stopped running.

Most boot-up should be complete by this time: runlevel 2 is entered by the rc-sysinit job, which does not start until filesystem and net-device-up IFACE=lo.

The upstart job start specifiction for the capture job should be:

  • start on stopped rc RUNLEVEL=2 and stopped plymouth

Capture actions

The following capture actions should be performed on boot completion:

  • smemcap

Graphical login completion

Graphical login completion is the time when GNOME has finished running desktop startup scripts and the 1-minute load average has dropped below 70%.

(The 70% figure is chosen to reflect a non-trivial but reasonably short idle interval which is shorter than the default screensaver timeout, i.e., about 20 seconds. Because I/O wait is treated as busy time by the load average, I/O stalls should not cause a non-idle system to be accidentally detected as idle, but this will need to be verified.)

According to https://bugs.launchpad.net/gnome-session/+bug/32194, GNOME runs startup scripts from ~/.config/autostart in alphanumeric name order, so giving a job a name such as zzname.desktop may be sufficient to ensure the job runs last.

Otherwise, it may be necessary to fork into the background and monitor the load average until it falls to an appropriate level.

Capture actions

The following capture actions should be performed on graphical login completion:

  • smemcap

  • xrestop

Platform/DevPlatform/Specs/MemoryFootprintMethodology (last modified 2011-02-09 09:31:13)