tohojo / flent

The FLExible Network Tester.
https://flent.org
Other
439 stars 78 forks source link

misc: Align tc_iterate behavior #312

Closed jkoeppeler closed 3 weeks ago

jkoeppeler commented 1 month ago

The execution of tc_iterate.sh can cause different behaviors depending on whether the tc_iterate binary is installed. The tc_iterate prog collects tc statistics "count"-times where as the bash loop runs for "length" seconds. This leads to different measuring durations.

This patch replaces the "count" parameter with the "length" parameter for tc_iterate.c CLI. tc_iterate.c then calculates the "count" based on the length to determine the duration.

tohojo commented 1 month ago

Hmm, so the problem with this is that with this change, flent will no longer work with an old version of tc_iterate, which can be a problem especially when running it on remote hosts. I think this may actually be why tc_iterate itself wasn't updated back when the script was.

Rather than dealing with doing this in a backwards-compatible way, I wonder if it isn't better to just deprecate the use of the tc_iterate binary entirely. I'm not sure the accuracy is actually that much worse for the shell script version. Did you observe a case where this was significant?

jkoeppeler commented 4 weeks ago

I compared the performance between the script and the binary by running both for 10 seconds with an interval of 0.01. This should capture 1000 data points. The bash script only captured 470 and the binary could record all 1000. Looking at the timestamps the binary is quite precisely able to trigger every 0.01 seconds where as the bash script only gets an accuracy of around 0.02. The tc_iterate binary is also able to capture everything up to an 0.001s interval.