stress

The stress command exercises the machine to its maximum:

This has the following benefits:

Notes:

Running MemoryTester stress

Using MemoryTester.app, choose a duration, then click Start.

MemoryTester verifies that memory hasn’t changed each time it copies it, by comparing the 'from' and 'to'. The timing/bandwidth counts the memcpy() time, which takes into account both read and write.

img
MemoryTester stress test in progress

The memory bandwidth in aggregate is shown in the 2nd column as seen below. The per thread bandwidth is shown in subsequent columns. Using the command line, you can compare memory bandwidth with different numbers of threads, but this is better done with the compute command. Allow some time for the numbers to settle down.

Speeds denote memory bandwidth: copy and compare speed (memcpy + 64-bit compare)
Allow several minutes for averages to stabilize, especially with large memory sizes.

 6s: 13242   828  828  828  828  828  828  828  828  828  828  828  828  828  828  828  828 (best)
10s: 16152  1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 (best)
16s: 20379  1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 1274 (best)
20s: 20443  1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 1278 (best)
26s: 18925  1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183 1183
30s: 19160  1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198 1198
36s: 20558  1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 1285 (best)
40s: 20572  1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 1286 (best)
46s: 21149  1343 1343 1231 1231 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1343 1231 (best)

Output discussion

The output displays the memory bandwidth in aggregate, and per thread. This is the speed at which the standard system call memcpy() can operate. As the note indicates, usable bandwidth is double the figure (eg 9248 * 2 as shown below. Note the “(best)” tag at right, this indicates the best result so far.

These figures are generally lower than claimed bandwidth by some testing programs and that’s normal: theoretical figures are silly; this is what a real program can actually achieve running on Mac OS X.

Checking for ECC memory errors (!!!)

Only the Mac Pro has ECC memory; other Macs would tend to simply crash with bad memory.

ECC memory errors indicate a problem—ECC errors should not occur under normal operating conditions. Return or exchange such memory immediately (no brand can be perfect). See also Testing Memory for Reliability.

Choose About This Mac then More Info, then clock on “Memory” (as shown below).

Mac OS X ECC memory status
Mac OS X ECC memory status

Command line usage

Many variations are possible, see below for useful examples. All testing is always non-destructive (if read/write is used for volumes, a temporary file is used).

stress
    [--percent-cpu|-p <percent>]               "100%"
    [--threads|-t <num>]                       "16"
    [--memory-per-thread|-m <size[b|K|M|G]>]   "1374MB"
    [--volumes|-v <all|[,<volume-name>]*>]     "all"
    [--read-write|-w]                          "true"
    [--duration|-d <num>[S|M|H]]>]                "8H"

Drain a laptop battery as quickly as possible (insert a DVD into the DVD drive first):

mt stress --volumes all --read-only

Run a stress test for one hour:

mt stress --duration 1H

Run a stress test but using only 50% of the CPU power:

mt stress --percent-cpu 50%

Run a test for 12 hours using 1GB memory for each of 24 threads while reading and writing to/from all volumes:

mt stress --memory-per-thread 1G --volumes all --duration 12H --threads 24 --read-write

Next page: vm