Bugzilla – Bug 2028
remove unnecessary Time to double conversions in wifi models
Last modified: 2015-01-04 13:18:26 UTC
This is a new bug for an issue discovered (and initially discussed) in the fix for bug 1969: https://www.nsnam.org/bugzilla/0. Some comments from Tommaso in bug 1969 follow: --- Speaking of, it could be a wise idea to change ALL the functions to NnanoSeconds, i.e.: - GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble) - GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble) - GetPlcpHtSigHeaderDurationMicroSeconds (payloadMode, preamble) - GetPlcpHtTrainingSymbolDurationMicroSeconds (payloadMode, preamble,txvector) - GetPayloadDurationMicroSeconds (size, txvector) and maybe others. Those should become: - GetPlcpPreambleDurationNanoSeconds etc. If I'm right, the original code idea was to avoid altogether to use a double... Speaking of... why GetPlcpPreambleDurationMicroSeconds ? Shouldn't it be GetPlcpPreambleDuration and return a Time ? WifiPhy::CalculateTxDuration is returning a Time. In that function a bunch of uint32_t are added, then a double (conversion to double), then a "Time" is created. What is the performance hit to sum a bunch of Time variables instead ? That would definitely make the code more foolproof and future-feature-proof. ---- so, the fix for this would be a patch that audits the code around this part of the codebase (WifiPhy) and removes unnecessary conversions to/from Time; may require some internal API changes...
Is someone already working on that or planned to work on that? If not, I may have a look at this issue.
I'd suggest to take a look at bug 1974 and see if the two can be harmonized.
Created attachment 1935 [details] patch to remove unnecessary Time to double conversions in wifi models I made a patch for this issue. It turns the ...DurationMicroSeconds into ...Duration and now return a Time instead of a double. I updated Doxygen as well. A good point is now that it removes the issues related to short guard intervals! Note that I also added some additional unit tests in the devices-wifi-tx-duration test suite.
promoted to bug, since it can cause a real error, +1 to push (need to rescan bindings).
pushed in changeset 11119:067928a573cd