Make AutoTimer usable with Closures
Summary: Currently, AutoTimer works only with FunctionObjects that are default constructible because it constructs Logger each time it needs to log. This diff makes AutoTimer work with closures too. This will help in making AutoTimer more flexible because the user can capture necessary dependencies in the lambda. This diff also cleans up the constructors on AutoTimer by making it take an std::string&& instead of Args... that is passed into folly::to<..>. Although this makes the instantiation a bit harder, the simplicity of constructor seems worth it. This also refactors the callsites of setMinLogTime to directly pass the value into the ctor and changes callsites on fbcode Reviewed By: yfeldblum Differential Revision: D3487868 fbshipit-source-id: 52fa1099a5e39b791972cc0d3f678d44ea4ba288
Showing
Please register or sign in to comment