stress
The stress command exercises the machine to its maximum:
- All available memory is allocated and read/written continually;
- All CPU cores are used at 100% utilization;
- Optionally, files are read continually from one or more or all mounted volumes of any kind.
This has the following benefits:
- Bad memory tends to fail when it gets hot; the intensive use makes it hot. So ECC errors (Mac Pro) and/or outright crashes mean something is flaky with your machine.
- You can test for worst case battery drain (laptop) by running stress.
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.
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
then , then clock on “Memory” (as shown below).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
Copyright © 2008-2010 diglloyd Inc, all rights reserved