https://github.com/apache/trafficserver/pull/7452
This PR changes TS API. It introduces this new type: typedef struct TSFDbgCtl_s { char volatile on; // Flag char const *tag; } TSFDbgCtl; And this function: tsapi TSFDbgCtl const *TSFDbgCtlCreate(char const *tag); And this new printf-like macro: #define TSFDbg(ctlp, ...) Where the first parameter is a pointer returned by TSFDbgCtlCreate(), the second a printf format string, and the rest the parameters referenced the format string. In my performance test, enabling the new type of debug output resulted in a 10% reduction in requests per second handled, versus a 95% reduction due to enabling the old type of debug output. (See https://gist.github.com/ywkaras/4b0386341a4a6ce0afacaf46dcce79d6 ) If we decide to proceed with this, I think we have two options: 1. Proceed with the approach where enabling low-overhead debug output will only work for Debug()/TSFDbg calls that use a DbgCtl/TSDbgCtl instance rather than a simple tag string. This would include adding doc changes and Au testing. 2. Switch to an approach similar to what I used for testing. Where Debug() calls and is_debug_tag_set() will (each) generate a hidden instance of DbgCtl. I think I can also make TSDebug() generate a hidden pointer to TSFDbgCt.