Linux Benchmarks
lmbench
How to build
$ uname -a
Linux masumi 6.14.0-27-generic #27~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:38:49 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ git clone https://github.com/intel/lmbench.git
$ cd lmbench
$ git show HEAD | head -n1
commit 941a0dcc0e7bdd9bb0dee05d7f620e77da8c43af
$ git diff --patch
diff --git a/scripts/build b/scripts/build
index d233b37..f41d549 100755
--- a/scripts/build
+++ b/scripts/build
@@ -18,7 +18,7 @@ done
trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15
-LDLIBS=-lm
+LDLIBS="-lm -ltirpc"
# check for HP-UX's ANSI compiler
echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
$ sudo apt install libtirpc-dev
$ make build CPPFLAGS="-I /usr/include/tirpc" LDFLAGS="-ltirpc" -j
Memory Read
Output format is ā%0.2f %.2f\nā, megabytes, megabytes_per_second,
measures the time to read data into the processor. It computes the sum of an array of integer values. It accesses every fourth word.
29.0 GiByte/sec
$ ./bin/x86_64-linux-gnu/bw_mem -W 3 -N 10 1024m rd
1073.74 29044.38
Memory Write
measures the time to write data to memory. It assigns a constant value to each memory of an array of integer values. It accesses every fourth word.
18.1 GiByte/sec
$ ./bin/x86_64-linux-gnu/bw_mem -W 3 -N 10 1024m wr
1073.74 18098.40
Memory Copy
measures the time to copy data from one location to another. It does an array copy: dest[i] = source[i]. It accesses every fourth word.
11.8 GiByte/sec
Note: 1 / (1 / 18.1 + 1 / 29.0) = 11.1
$ ./bin/x86_64-linux-gnu/bw_mem -W 3 -N 10 1024m cp
1073.74 11845.05
TCP bandwidth
$ ./bin/x86_64-linux-gnu/bw_tcp -s
$ ./bin/x86_64-linux-gnu/bw_tcp -W 3 -N 10 -M 1024m localhost
1073.741824 5434.25 MB/sec
Pipe Bandwidth
$ ./bin/x86_64-linux-gnu/bw_pipe -W 3 -N 10 -M 1024m
Pipe bandwidth: 3704.20 MB/sec
Syscall Latency
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 null
Simple syscall: 0.1328 microseconds
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 read
Simple read: 0.2191 microseconds
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 write
Simple write: 0.2009 microseconds
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 stat
Simple stat: 1.0037 microseconds
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 fstat
Simple fstat: 0.3176 microseconds
$ ./bin/x86_64-linux-gnu/lat_syscall -W 3 -N 10 open
Simple open/close: 2.1441 microseconds
File System Latency
The results are in terms of creates per second and deletes per second as a function of file size. The output is in 4 column form and is the size of the file, the number created, the creations per second, and the removals per second.
So for 10k files, we need 19 microseconds to create a file and 10.9 microseconds to remove it.
$ ./bin/x86_64-linux-gnu/lat_fs
0k 484 85877 142831
1k 376 67529 111745
4k 368 66402 109158
10k 293 51758 91642
Context Switch Latency
The unit is in microseconds.
$ ./bin/x86_64-linux-gnu/lat_ctx -W 3 -N 10 -s 1 2 4 8 16
"size=1k ovr=0.67
2 3.37
4 3.80
8 3.89
16 4.25