Skip to content
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

Improve performance of OS_DebugPrintf #870

Open
skliper opened this issue Mar 10, 2021 · 0 comments
Open

Improve performance of OS_DebugPrintf #870

skliper opened this issue Mar 10, 2021 · 0 comments

Comments

@skliper
Copy link
Contributor

skliper commented Mar 10, 2021

Is your feature request related to a problem? Please describe.
OS_DebugPrintf checks the level and doesn't do the work, but the caller still sets up the variable arguments. It's better to have a table of function pointers that change when the level changes to either the debug printf or a no-op.

extern void OS_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...);
/* Debug printfs are compiled in, but also can be disabled by a run-time flag.
* Note that the ##__VA_ARGS__ syntax works on GCC but might need tweaks for other compilers... */
#define OS_DEBUG_LEV(l, ...) OS_DebugPrintf(l, __func__, __LINE__, __VA_ARGS__);
#define OS_DEBUG(...) OS_DEBUG_LEV(1, __VA_ARGS__)

Describe the solution you'd like
Table of function pointers

Describe alternatives you've considered
Leave as-is (future work), this is debug code which wouldn't typically be included in production

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review

jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022
Apply the appid/taskid pattern to Generic Counter resources.
No real logic change - just putting the repeated logic into
inline functions.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant