On 10/3/14 1:12 PM, Eric Rahm wrote:
Hi all-
In bug 806819 we're planning on landing a change that allows us to turn
on NSPR logging in release builds [1]. To be clear, by default all
logging output is disabled, this will just allow you to turn on logging
via the same mechanisms [2] that have been available to debug builds and
modules that already force logging to be enabled.
Initial tests show no impact to performance, but of course it's possible
there will be unforeseen regressions. Testing included all Talos tests,
averaging of mochitest runtimes, and local ad-hoc performance measurements.
Areas to look out for:
* Logging being done in "hot" areas. PR_LOG is no longer a no-op so
there is a slight amount of overhead with each logging call. If
your output is truly debug only consider wrapping in a #ifdef DEBUG
block.
* Creating a log message and then logging it. PR_LOG supports printf
style formatting, so you can save some overhead by using that
rather than writing to your own buffer.
For example, if you once had:
#ifdef PR_LOGGING
char* msg = expensiveFunction();
PR_LOG(module, PR_LOG_DEBUG, (msg));
#endif
You'll want to move to:
PR_LOG(module, PR_LOG_DEBUG, ("%s", expensiveFunction()));
If you're interested in making logging better, please take a look at our
meta bug [3] tracking various improvements. There's talk of making
improvements to NSPR logging, ditching NSPR logging all together, adding
streaming interfaces, switching log levels at runtime, and more. Feel
free to join in the conversation.
Please note: after this change you should never need to use FORCE_PR_LOG
(and you'll probably get build errors if you do).
A few side benefits:
* All usage of FORCE_PR_LOG has been removed
* Many more files are now eligible for unified building
-e
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=806819
[2]
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/Logging
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=881389
This has landed, so far one issue has been reported for VS2013 builds
[1] that has a pending solution for the underlying problem, this is not
related to enabling logging but was exposed as part of the effort to get
files added back in to unified compilation.
Many files were added back into unified compilation that were explicitly
excluded due to "NSPR logging" and "uses FORCE_PR_LOG (those are the
terms I searched for), if you know of others that may not have been as
easily found please follow up and add them back into the UNIFIED_SOURCES.
Also of course, don't use FORCE_PR_LOG anymore. You'll most likely get
-Werror failures due to redefined macros. Please check your pending patches!
-e
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1080297
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform