[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5b2e2f50-a222-81e9-4383-c503d9a8fbe4@leemhuis.info>
Date: Tue, 23 Jun 2020 11:54:37 +0200
From: Thorsten Leemhuis <linux@...mhuis.info>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: lwn@....net
Subject: kcbench, the Linux kernel compile benchmark, version 0.9.0 is out
TWIMC: I released version 0.9.0 of kcbench, a simple Linux kernel
compile benchmark. It basically downloads a Linux version (which one
depends on the compiler used), extracts it, creates a configuration
('defconfig' by default), before it compiles a kernel ('vmlinux') in a
temporary directory ('O=/tmp/foo/') while measuring the time it takes to
build. It compiles a few kernels that way using different number of jobs
(make -j #). After each run kcbench prints the time it took and how many
kernels the machine can build per hour at this rate.
This is how it looks:
> [cttest@...alhost ~]$ kcbench
> Processor: Intel(R) Core(TM) i5-3350P CPU @ 3.10GHz [4 CPUs]
> Cpufreq; Memory: powersave [intel_pstate]; 7895 MiB
> Linux running: 5.6.2-125.vanilla.knurd.1.fc31.x86_64 [x86_64]
> Compiler: gcc (GCC) 9.3.1 20200317 (Red Hat 9.3.1-1)
> Linux compiled: 4.19.0 [/home/thl/.cache/kcbench/linux-4.19/]
> Config; Environment: defconfig; CCACHE_DISABLE="1"
> Build command: make vmlinux
> Filling caches: This might take a while... Done
> Run 1 (-j 4): 288.16 seconds / 12.49 kernels/hour [P:384%]
> Run 2 (-j 4): 288.19 seconds / 12.49 kernels/hour [P:384%]
> Run 3 (-j 6): 291.01 seconds / 12.37 kernels/hour [P:384%]
> Run 4 (-j 6): 291.28 seconds / 12.36 kernels/hour [P:385%]
You can use the benchmark to compare different machines, just make sure
they use a similar compiler. Kcbench can be useful for stress tests,
too. It's also a good tool to find the optimal number of jobs for
compiling source code, as 'just use all cores' sometimes is not the
fastest setting, as a quick test on an AMD Ryzen Threadripper 3990X (64
cores/128 threads) recently showed:
> [cttest@...alhost ~]$ kcbench -s 5.3 -n 1 -m
> Processor: AMD Ryzen Threadripper 3990X 64-Core Processor [128 CPUs]
> Cpufreq; Memory: Unknown; 63736 MByte RAM
> Linux running: 5.6.0-0.rc2.git0.1.vanilla.knurd.2.fc31.x86_64
> Compiler used: gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)
> Linux compiled: 5.3.0 [/home/cttest/.cache/kcbench/linux-5.3/]
> Config; Environment: defconfig; CCACHE_DISABLE="1"
> Build command: make vmlinux
> Run 1 (-j 128): 260.43 seconds / 13.82 kernels/hour
> Run 2 (-j 136): 262.67 seconds / 13.71 kernels/hour
> Run 3 (-j 64): 215.54 seconds / 16.70 kernels/hour
> Run 4 (-j 72): 215.97 seconds / 16.67 kernels/hour
(this is a quote from the man-page, which has a few more results)
For more general information about kcbench see:
* its project page:
https://gitlab.com/knurd42/kcbench/
* its README:
https://gitlab.com/knurd42/kcbench/-/blob/master/README.md
* the man-page for kcbench, which tries to compile one Linux kernel
really fast by using many jobs:
https://gitlab.com/knurd42/kcbench/-/raw/master/kcbench.man1.md
* the man-page for kcbenchrate (which is new with 0.9.0 [thx arnd for
the suggestion]), which by default compiles one kernel on each CPU using
one job to measure the rate and keep the all cores busy all the time:
https://gitlab.com/knurd42/kcbench/-/raw/master/kcbenchrate.man1.md
* the release page for kcbench 0.9.0, which list all its major
improvements:
https://gitlab.com/knurd42/kcbench/-/releases/v0.9.0
To quickly outline the potential briefly, here is what a
'kcbench --help' will show:
> Usage: kcbench [options]
>
> Compile a Linux kernel and measure the time it takes.
>
> Available options:
> -b, --bypass -- bypass cache fill run and measure immediately
> -d, --detailedresults -- print more detailed results
> -i, --iterations <int> -- number or iterations per job
> -j, --jobs <int> (*) -- number of jobs to use ('make -j #')
> -m, --modconfig -- build using 'allmodconfig vmlinux modules'
> -o, --outputdir <dir> -- compile in <dir>/kcbench/ ('make O=#')
> -q, --quiet -- quiet
> -s, --src (<dir>|<version>) -- take Linux sources from <dir>; if not found
> try ~/.cache/kcbench/linux-<version>/ and
> /usr/share/kcdata/linux-<version>/; if still
> not found download <version> automatically.
> -v, --verbose (*) -- increase verboselevel
>
> --add-make-args <str> -- pass <str> to make call ('make <str> vmlinux')
> --cc <exec> -- use specified target compiler ('CC=#')
> --cross-compile <arch> -- cross compile for <arch>
> --crosscomp-scheme <str> -- naming scheme for cross compiler
> --hostcc <exec> -- use specified host compiler ('HOSTCC=#')
> --infinite -- run endlessly
> --llvm -- sets 'LLVM=1' to use clang and LLVM tools
> --no-download -- never download anything automatically
> --savefailedlogs <dir> -- save log from failed compilations in <dir>
>
> -h, --help -- show this text
> -V, --version -- output program version
>
> (*) -- option can be passed multiple times
Ciao, Thorsten
P.S.: kcbench is written in Bash, as it started quite small and grew a
lot over time. Maybe at this point bash might not be the best choice,
but OTOH it's something that runs nearly everywhere; it also understood
by a lot of people, which makes it easy to adjust to specific needs.
Powered by blists - more mailing lists