1hackbench(8) hackbench(8)
2
3
4
5# SPDX-License-Identifier: GPL-2.0-or-later
6
8 hackbench - scheduler benchmark/stress test
9
11 hackbench [-f|--fds NUM] [-F|--fifo] [-g|--groups NUM] [-h|--help]
12 [-l|--loops LOOPS] [-p|--pipe] [-s|--datasize SIZE] [-T|--threads]
13 [-P|--process]
14
15
17 Hackbench is both a benchmark and a stress test for the Linux kernel
18 scheduler. It's main job is to create a specified number of pairs of
19 schedulable entities (either threads or traditional processes) which
20 communicate via either sockets or pipes and time how long it takes for
21 each pair to send data back and forth.
22
23
25 These programs follow the usual GNU command line syntax, with long op‐
26 tions starting with two dashes ("--").
27 A summary of options is included below.
28
29 -f, --fds=NUM
30 Defines how many file descriptors each child should use. Note
31 that the effective number will be twice the amount you set here,
32 as the sender and receiver children will each open the given
33 amount of file descriptors.
34
35 -F,--fifo
36 Change the main thread to SCHED_FIFO after creating workers.
37 This allows the management thread to run after many workers are
38 created.
39
40 -g, --groups=NUM
41 Defines how many groups of senders and receivers should be
42 started
43
44 -h, --help
45
46 -l, --loops=LOOPS
47 How many messages each sender/receiver pair should send
48
49 -p, --pipe
50 Sends the data via a pipe instead of the socket (default)
51
52 -s, --datasize=SIZE
53 Sets the amount of data to send in each message
54
55 -T, --threads
56 Each sender/receiver child will be a POSIX thread of the parent.
57
58 -P, --process
59 Hackbench will use fork() on all children (default behaviour)
60 Shows a simple help screen
61
63 Running hackbench without any options will give default behaviour, us‐
64 ing fork() and sending data between senders and receivers via sockets.
65
66 user@host: ~ $ hackbench
67 Running in process mode with 10 groups using 40 file descriptors each
68 (== 400 tasks)
69 Each sender will pass 100 messages of 100 bytes
70 Time: 0.890
71
72 To use pipes between senders and receivers and using threads instead of
73 fork(), run
74
75 user@host: ~ $ hackbench --pipe --threads (or hackbench -p -T)
76 Running in threaded mode with 10 groups using 40 file descriptors each
77 (== 400 tasks)
78 Each sender will pass 100 messages of 100 bytes
79 Time: 0.497
80
81 Set the datasize to 512 bytes, do 200 messages per sender/receiver
82 pairs and use 15 groups using 25 file descriptors per child, in process
83 mode.
84
85 user@host: ~ $ hackbench -s 512 -l 200 -g 15 -f 25 -P
86 Running in process mode with 15 groups using 50 file descriptors each
87 (== 750 tasks)
88 Each sender will pass 200 messages of 512 bytes
89 Time: 4.497
90
92 hackbench was written by Rusty Russell <rusty@rustcorp.com.au> with
93 contributions from Yanmin Zhang <yanmin_zhang@linux.intel.com>, Ingo
94 Molnar <mingo@elte.hu> and David Sommerseth <davids@redhat.com>
95
96 This manual page was written by Clark Williams <williams@redhat.com>
97 and David Sommerseth <davids@redhat.com>
98
100 This version of hackbench is based on the code downloaded from
101 http://people.redhat.com/mingo/cfs-scheduler/tools/hackbench.c. Yanmin
102 Zhang merged the original hackbench code from
103 http://devresources.linuxfoundation.org/craiger/hackbench/src/hack‐
104 bench.c which uses fork() and a modified version from
105 http://www.bullopensource.org/posix/pi-futex/hackbench_pth.c which uses
106 pthread only and gave the possibility to change behaviour at run time.
107 Hackbench have since then gone through some more rewriting to improve
108 error handling and proper tracking of fork()ed children, to avoid leav‐
109 ing zombies on the system if hackbench stops unexpectedly.
110
111
112
113 September 19, 2020 hackbench(8)