[bug #55199] ppp: inefficient debug disable

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #55199] ppp: inefficient debug disable

Simon Goldschmidt
URL:
  <https://savannah.nongnu.org/bugs/?55199>

                 Summary: ppp: inefficient debug disable
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: dushevny
            Submitted on: Mon 10 Dec 2018 11:22:59 PM UTC
                Category: PPP
                Severity: 3 - Normal
              Item Group: Change Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

Even in PPP debug output disabled by not defining PPP_DEBUG macro,
ppp_dbglog(), ppp_info(), ppp_notice() etc. functions calls ppp_logit()
function, which allocates 1024 bytes on stack, wastes CPU time in
ppp_vslprintf() and calls ppp_log_write(), where debug output is actually
disabled by PPPDEBUG() defined to empty code. Additionally all ppp debug
strings are also linked into resulting executable. Replacing debug functions
declaration in ppp_impl.h with
#if PPP_DEBUG
void ppp_dbglog(const char *fmt, ...);    /* log a debug message */
void ppp_info(const char *fmt, ...);      /* log an informational message */
void ppp_notice(const char *fmt, ...);    /* log a notice-level message */
void ppp_warn(const char *fmt, ...);      /* log a warning message */
void ppp_error(const char *fmt, ...);     /* log an error message */
void ppp_fatal(const char *fmt, ...);     /* log an error message and die(1)
*/
#else
#define ppp_dbglog(...)     do {} while(0)  /* log a debug message */
#define ppp_info(...)       do {} while(0)  /* log an informational message
*/
#define ppp_notice(...)     do {} while(0)  /* log a notice-level message */
#define ppp_warn(...)       do {} while(0)  /* log a warning message */
#define ppp_error(...)      do {} while(0)  /* log an error message */
#define ppp_fatal(...)      do {} while(0)  /* log an error message and die(1)
*/
#endif
and small sources tuning to suppress warnings about unused variables reduces
executable size for more than 5 Kbytes on Cortex-M3 target, saves more than 1
K RAM on lwip main process stack and makes code faster by not executing
needless code.





    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55199>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #55199] ppp: inefficient debug disable

Simon Goldschmidt
Update of bug #55199 (project lwip):

                Severity:              3 - Normal => 1 - Wish              
                  Status:                    None => Confirmed              
             Assigned to:                    None => gradator              


    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55199>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #55199] ppp: inefficient debug disable

Simon Goldschmidt
Follow-up Comment #1, bug #55199 (project lwip):

Sylvain, would you be ok with changing the ppp_*() functions to ppp_*(())
macros? That way, the macros would ensure debug code is not linked when
disabled.

The change in ppp_impl.h and utils.c is minimal, however, all occurrences of
those calls are changed from () to (()). See attached patch.

(file #48199)
    _______________________________________________________

Additional Item Attachment:

File name: 0001-ppp-don-t-link-debug-functions-if-disabled.patch Size:66 KB
   
<https://savannah.nongnu.org/file/0001-ppp-don-t-link-debug-functions-if-disabled.patch?file_id=48199>



    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55199>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #55199] ppp: inefficient debug disable

Simon Goldschmidt
Update of bug #55199 (project lwip):

                  Status:               Confirmed => Fixed                  
             Assigned to:                gradator => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #2:

Applied that patch, see task #14798

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55199>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel