fako1024/slimcap

Provide slimcap_nomock build tag (and allow feature toggle)

Closed this issue · 0 comments

In order to support mock tests using stand-in capture sources it was necessary to add some guards against data races in the TPacket access process. Furthermore, socket handling required some additions as well in order to support mocking in the first place. In addition to the increase in complexity these modifications also incur a (granted, small) performance penalty due to the more complex code paths and the atomic nature of some operations not required unless mocking is used.

In order to provide more control over these features / modifications, a simple build tag that allows disabling mock functionality (and all that comes with it) would be helpful. Depending on the scenario, this could also be used as a "production mode" toggle for projects using slimcap (squeezing out the last bit of performance while also removing all mock code & specifics from production binaries).

DoD

  • Add build tag slimcap_nomock
  • Restructure code and tests so that the toggle disables mock handling and maximizes throughput in that case