-
Notifications
You must be signed in to change notification settings - Fork 171
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
log: add function name, line number prefix #254
Conversation
@kernelchuk do you have some measurement of the increase of the footprint adding this? Any reason to not merge this PR with #250? |
None. I just pushed a new branch as a replacement for #250. Should I go back to #250?
I estimate the upper bound to be less than 1000 bytes:
Where 'total' is a running total of bytes; 'len' is the length of "function-name:line-number"; M is the number of log messages in the function. I'm assuming that all line numbers are 3 digits long, so counting as 5 for ":nnn ". We get under 1000 bytes if we adjust for the exiting
We can mitigate the increased memory footprint with conditional compilation, borrowing from printk in the kernel. |
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.
This should be conditional. Many deployments of OpenAMP will not have any log output visible to the user, so adding extra size is not useful for them.
Yes, I'm working on a version to make it conditional. |
Hi @arnopo,
I have scanned the readthedocs.io link, but still not sure how to avoid it. Any hints? |
@wmamills : I guess we can ignore the doc generation issue for now, right? |
@arnopo, yes ignore it until that enabling PR is accepted. The hook is installed already but the needed file is not yet in main. |
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.
Much better§
Few new remarks
6fad210
to
06ed5e5
Compare
Add convenience macros metal_err, metal_warn, metal_info, metal_dbg to avoid using excessively long and redundant metal_log(METAL_LOG_*). Add "function-name:line-number" prefix to all messages if the option WITH_FUNC_LINE_LOG is set ON during the configuration phase. Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
@arnopo If all looks good, can we include the change in coming release as well? |
@kernelchuk Please close #250 as it's duplicate of this. |
See also #250
Add "function-name:line-number" prefix and a new-line suffix for all messages. Use do-while(0) to define the metal_log macro. Add convenience macros ML_ERR, ML_WRN, ML_INF, ML_DBG to avoid using excessively long and redundant "metal_log(METAL_LOG_*".
I had to change s/irq/IRQ/ to fix the checkpatch warning:
EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'irq', this function's name, in a string