Project

General

Profile

Bug #5589

Log of debugging messages is enabled in non-debugging builds

Added by Gianluca Petrillo over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Install / build / code mgmt
Target version:
-
Start date:
03/04/2014
Due date:
% Done:

100%

Estimated time:
2.00 h
Occurs In:
Experiment:
-
Co-Assignees:
Duration:

Description

The message facility is supposed, by art prescription, to disable the dispatch of debug messages in production builds (prof, opt).
Currently this dispatch is enabled in all cases.
This can cause slow-down (in some cases, a severe one).
Following art prescriptions will lead to a general speed up of the code (mileage varies greatly!) and less ability of debug logging in production builds.

History

#1 Updated by Erica Snider over 5 years ago

  • Status changed from New to Assigned

#2 Updated by Gianluca Petrillo over 5 years ago

  • % Done changed from 0 to 80

The LOG_DEBUG macro, defined in messagefacility package, is disabled when in production mode (in our case, prof and opt).
It relies on the standard macro NDEBUG: if the latter is defined, LOG_DEBUG is (close to?) a no-op.
The standard macro NDEBUG is also the one determining whether the assert macro is enabled or not.
For that reason and some questionable code practices (#5174), NDEBUG was forcibly deactivated in most of LArSoft, causing LOG_DEBUG to come back alive.

The fact that LOG_DEBUG is honoured is usually not seen, because normally the debug log stream is dropped anyway.
But it is felt, because before dropping it, the message is fully computed.
The most spectacular example is in LArG4 module, where LOG_DEBUG appears in a inner loop called tens of millions of times per event.

#3 Updated by Gianluca Petrillo over 5 years ago

Committed a fix aimed to deactivate LOG_DEBUG macro for non-production builds (the same ones where NDEBUG would be normally set).
This is a temporary fix: once issue #5174 is fixed, both this change and the removal of NDEBUG will go.

Now LOG_DEBUG does not emit messages anymore unless using the debug qualifier, regardless the verbosity level configured in FCL files.
This was the intended behaviour per art directions, and it can yield relevant improvements to execution speed.
If you really, really want debug information in a non-debug build, you can still use mf::LogDebug, adding the file and line number information by hand:

::mf::LogDebug("MyDebug", __FILE__, __LINE__) << "this message is too important to be skipped";

(I haven't checked this line, it's just to give the idea).

#4 Updated by Gianluca Petrillo over 5 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 90

#5 Updated by Gianluca Petrillo over 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 90 to 100


Also available in: Atom PDF