File: filter_seccomp-perf.test

package info (click to toggle)
strace 6.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 64,424 kB
  • sloc: ansic: 160,349; sh: 9,223; makefile: 3,817; cpp: 944; awk: 353; perl: 267; exp: 62; sed: 9
file content (27 lines) | stat: -rwxr-xr-x 861 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# Check seccomp filter performance.
#
# Copyright (c) 2019 Paul Chaignon <paul.chaignon@gmail.com>
# Copyright (c) 2018-2021 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${srcdir=.}/init.sh"
. "${srcdir=.}/filter_seccomp.sh"

args="-f -qq -e signal=none -e trace=fchdir ../$NAME"
num_regular="$(run_strace               $args)"
mv "$LOG" "$LOG.regular"
num_seccomp="$(run_strace --seccomp-bpf $args)"
mv "$LOG" "$LOG.seccomp"
match_diff "$LOG.regular" "$LOG.seccomp"

min_ratio=5
# With seccomp filter enabled, we should be able to complete
# at least $min_ratio times more chdir system calls.
ratio="$((num_seccomp / num_regular))"
if [ "$ratio" -lt "$min_ratio" ]; then
	fail_ "Only $ratio times more syscalls performed with seccomp filter enabled, expected at least $min_ratio times speedup"
fi