[RFC PATCH 3/4] Test pidns translation cache
Dmitry V. Levin
ldv at altlinux.org
Sat Aug 15 12:37:42 UTC 2020
On Thu, Aug 13, 2020 at 05:32:41PM +0200, Ákos Uzonyi wrote:
[...]
> +/**
> + * There is a 1 sec timeout for this test. With pidns caching more than 1000
> + * syscalls can be executed, without caching only a few tens.
> + */
> +#define SYSCALL_COUNT 200
> +
> +int
> +main(void)
> +{
> + pidns_test_init();
> +
> + for (int i = 0; i < SYSCALL_COUNT; i++)
> + getpid();
> +
> + return 0;
> +}
As getpid can be easily cached by libc, this has to be a syscall().
With regards to the number of syscalls, some hosts could be very slow, so
I suggest to count the number of syscalls without any pid translation and
use it as a baseline.
--
ldv
More information about the Strace-devel
mailing list