summaryrefslogtreecommitdiff
path: root/trafgen.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-01-30 07:50:43 -0800
committerDaniel Borkmann <dborkman@redhat.com>2015-01-30 16:54:47 +0100
commit319840b83b70b49705928687dcbd40653709e305 (patch)
tree0b364897eea1e8ed52b4c9da876282ee949f693e /trafgen.c
parente6890cb3e59ec4bdbe57e999592b9488fcfa1f80 (diff)
trafgen: disable timer slack
linux has default time slack of 50 usec, which means that trafgen 'gap' option is unable to precisely control delays. Set the process timer slack to the minimum of 1 nsec. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'trafgen.c')
-rw-r--r--trafgen.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/trafgen.c b/trafgen.c
index 0a645d4..9151b5d 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/fsuid.h>
+#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
@@ -957,6 +958,7 @@ int main(int argc, char **argv)
case 't':
slow = true;
ptr = optarg;
+ prctl(PR_SET_TIMERSLACK, 1UL);
gap = strtoul(optarg, NULL, 0);
for (j = i = strlen(optarg); i > 0; --i) {