]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
speedtest: Count the system time as well as the user time 10755/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 23 Sep 2021 08:42:17 +0000 (10:42 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 23 Sep 2021 08:42:17 +0000 (10:42 +0200)
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

index 50f40cb1199005707a4765603801dd73dc3fda53..e3f181068ed33d9ccfde6cdafad25e5ae5fd2a1c 100644 (file)
@@ -36,8 +36,8 @@ template<typename C> 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;