From: Vadim Kochan <[email protected]>
Trafgen uses all the online cpus even if number of packets specified
by -n is less than numbers of selected cpus.
Such behaviour leads to issues:
- trafgen re-calculates number of packets per cpu which
leads to rounding it to 0 then no packets will be sent.
- trafgen might send more packets than specified by -n because
of using all the online cpus.
Fixed by calculation the minimum number of cpus for generation
number of packets specified by -n.
Signed-off-by: Vadim Kochan <[email protected]>
---
trafgen.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/trafgen.c b/trafgen.c
index 9151b5d..f2d2ffe 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -1038,6 +1038,9 @@ int main(int argc, char **argv)
}
}
+ if (ctx.num)
+ ctx.cpus = min_t(unsigned int, ctx.num, ctx.cpus);
+
if (argc < 5)
help();
if (ctx.device == NULL)
--
2.3.1
--
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.