summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2021-10-11 16:46:16 +0200
committerEugene Syromyatnikov <evgsyr@gmail.com>2021-10-12 00:35:48 +0200
commit5e63fc252357aa7c39fe5b391e1ba1db19e5f765 (patch)
treeb869b25bfaf14bc3f96aaf76faa47ebaa15489ef
parentb9a308a6e921761756b2ba32a62ee413bd67dfcd (diff)
downloadstrace-5e63fc252357aa7c39fe5b391e1ba1db19e5f765.tar.gz
tests: try to make pidns-cache test a bit more robust
Increase SYSCALL_COUNT tenfold in an attempt to get more stable time measurements. While at it, print some additional information about the time spent. * tests/pidns-cache.c (SYSCALL_COUNT): Change from 1000 to 10000. (main): Store original run time in orig_us variable, print it along with the run time under the PID NS test harness in a message to stderr.
-rw-r--r--tests/pidns-cache.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/pidns-cache.c b/tests/pidns-cache.c
index 6319a7fda..b80228d07 100644
--- a/tests/pidns-cache.c
+++ b/tests/pidns-cache.c
@@ -15,7 +15,7 @@
# include <unistd.h>
# include <sys/time.h>
-# define SYSCALL_COUNT 1000
+# define SYSCALL_COUNT 10000
/**
* Max ratio of the execution time with and without pidns translation.
@@ -43,11 +43,17 @@ execute_syscalls(void)
int
main(void)
{
- long max_us = execute_syscalls() * MAX_TIME_RATIO;
+ long orig_us = execute_syscalls();
+ long max_us = orig_us * MAX_TIME_RATIO;
pidns_test_init();
long us = execute_syscalls();
+
+ fprintf(stderr, "Before PID NS test init: %ld\n"
+ "After PID NS test init: %ld (%.2f times slower)\n",
+ orig_us, us, (float) us / orig_us);
+
if (us > max_us)
error_msg_and_fail("pidns translation took too long: %ld us "
"(max: %ld us)", us, max_us);