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