Richard HJ's Web Site

mem_bw Home Page

Tool to Measure the Memory Bandwidth

mem_bw ses the CPU to read, write or read-modify-write areas of memory. The size and number of reads or writes can be set.
This is based on chachebench from llcbench but allows cpu usage to be measures and can be set to run with one setting for a number of cycles, rather than just scan the read/write size. It uses unrolled loops, but the results are quite dependant on compiler sophistication!


The program is run as follows:
Usage: mem_bw -option<parameter> [...]

The command options are:

-b = <size of data read/written from/to memory in kbytes [20 kBytes]>
-l = <no. of read or writes to do >
-m = do read-mod-write test
-q = quiet - only print results
-r = do read test
-v = turn on debug printout
-w = do write test
-B = <bin width of histo in us>
-H = histograms
-M = <min (low limit) of histo in us>

Installation of mem_bw

The distribution of mem_bw is split into two tarballs: the mem_bw tool and the supporting library libhj. The mem_bw-a.b.c tarball creates directory mem_bw-a.b.c and libhj-l.m.n creates directory libhj-l.m.n. For installation and compilation in your home directory having downloaded the corresponding mem_bw and library files, start by cd to the library directory then:

./configure --prefix=$HOME
make install

$HOME/include and $HOME/lib are created. Then cd to the directory containing mem_bw and do:

./configure --prefix=$HOME --with-hj-location=$HOME
make install

$HOME/sbin is created with the mem_bw program.

Versions of mem_bw



libhj library


Excel plots example



tar file


tar file



Enjoy, but the usual disclaimers apply!

Feedback is welcome!

© 2006, 2007, 2008, 2009, 2010, 2011 Richard Hughes-Jones (
22 Jan 2011.

Copyright notice | Disclaimer | Privacy Policy |