logging: reduce the amount of code emitted for log statements
Summary: This refactors the logging code with the aim of reducing the amount of assembly code emitted for each log statement, particularly for `XLOG()` statements. Ideally it should be possible to put debug `XLOG()` statements throughout your code without having to worry about the performance overhead. Therefore we should attempt to make sure that `XLOG()` statements do not generate a lot of assembly and hurt icache performance. This diff does not have any code behavior changes--it just moves code around a bit. The high-level summary is: - Move as much code as possible into the LogStreamProcessor constructors and destructor. Make sure these methods are defined in LogStreamProcessor.cpp to avoid having them be emitted inline at each log statement. - Move some of the XLOG level checking logic into separate non-inline functions defined in xlog.cpp - Pass xlog category information around as a pair of (categoryName, isOverridden) parameters. If isOverridden is true then the categoryName parameter should be used as the category name directly. If isOverridden is false, then categoryName is a filename that needs to go through filename to category name string processing. This allows the category name processing to be done in non-inlined code. Reviewed By: wez Differential Revision: D5269976 fbshipit-source-id: 7a7877ddfed66cd27ed82f052330b6aa2be4b37b
Showing
Please register or sign in to comment