From 0a5af93338e428a1b936ffcf4a1a3f0b994ce2f6 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 23 Sep 2021 10:42:17 +0200 Subject: [PATCH] speedtest: Count the system time as well as the user time Our tests are designed to run for 100 ms of CPU time, but this is currently measured with `ITIMER_VIRTUAL` which means only when the process is executing in userspace. Switching to `ITIMER_PROF` would also account for the time spent when the system is running on behalf of the process, which seems closer to what we want. --- pdns/speedtest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/speedtest.cc b/pdns/speedtest.cc index 50f40cb119..e3f181068e 100644 --- a/pdns/speedtest.cc +++ b/pdns/speedtest.cc @@ -36,8 +36,8 @@ template void doRun(const C& cmd, int mseconds=100) it.it_interval.tv_sec=0; it.it_interval.tv_usec=0; - signal(SIGVTALRM, alarmHandler); - setitimer(ITIMER_VIRTUAL, &it, 0); + signal(SIGPROF, alarmHandler); + setitimer(ITIMER_PROF, &it, 0); unsigned int runs=0; g_stop=false; -- 2.47.2