New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: upsdebug*() routines pass data and allocate vars always #685
Problem: upsdebug*() routines pass data and allocate vars always #685
Conversation
Solution: wrap old well-known API routines into macros that check debugging level first, and only invest into calling routines and passing data later - if that would not be in vain. Signed-off-by: Jim Klimov <EvgenyKlimov@eaton.com>
c6d6ba6
to
3041be3
Compare
The results are not extremely conclusive due to fluctuation in numbers and other congestion in the test system. With both older and newer binaries in place, difference between lack of debugging and full debug (6
It seems that the version in PR adds a few fractions of a second benefit compared to "old" version, but this is the part hard to prove :) With high debugging level in place, both old and new binaries return comparable amounts of lines (29020 vs 29023, when piped to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The parenthesized "(label)" in debug macros is a safer expansion than the original "label"
* The parenthesized "(label)" in debug macros is a safer expansion than the original "label" * Avoid the dangling "args..." that may be not-specified by caller (C99 compat)
* The parenthesized "(label)" in debug macros is a safer expansion than the original "label" * Avoid the dangling "args..." that may be not-specified by caller (strict-C99 compat)
* The parenthesized "(label)" in debug macros is a safer expansion than the original "label" * Avoid the dangling "args..." that may be not-specified by caller (strict-C99 compat)
Solution: wrap old well-known API routine names into macros that check debugging level first, and only invest into calling routines and passing data later - if that would not be in vain.
This should make "production-mode" runs a bit more efficient in CPU churn. We have tens of thousands debugging calls that are typically ignored during the daemon lifetime.
Signed-off-by: Jim Klimov EvgenyKlimov@eaton.com