From: Eric Dumazet <[email protected]>

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 <[email protected]>
---
 trafgen.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/trafgen.c b/trafgen.c
index 0a645d4..1cfa1f8 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) {


-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to