-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add support and sample backend for dictionary-based logging #30539
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
Add support and sample backend for dictionary-based logging #30539
Conversation
d6dd92f to
80bd99a
Compare
9d4826b to
6e29a38
Compare
|
CI's failure to build documentation is not related to this PR. |
6e29a38 to
733e716
Compare
|
@dcpleung please look at #30353. I started to work on logging subsystem overhaul to enable missing features which cannot be achieved with current design. The main change will be that log message will be self contained (string duplication will be inside the message). Messages will no longer be fragmented. This will significantly simplify dictionary based logging because dictionary backend will just transmit raw message as is. To make that happen there is also an ongoing work in cbprintf to allow that (#30675) by introducing a concept of string package. A string package contains serialized arguments. Strings are treated specially, they can be stored by address or by value. There is 1 one header which indicates mode and address or content follows. Cbprintf will support formatting a string from a package in parallel to standard formatting from va_list. |
733e716 to
c70257c
Compare
@nordic-krch what are you suggesting here? Wait for the overhaul? What is the timeline? |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
ab55b47 to
5b6f2d6
Compare
This comment has been minimized.
This comment has been minimized.
bc493ab to
4210223
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
One of the loop is using int as loop variable but it's being compared against size_t. Some compiler configuration has -Wsign-compare turned on by default which will complain about "comparison of integer expressions of different signedness". So fix it by changing the loop variable to be size_t also. Signed-off-by: Daniel Leung <[email protected]>
This adds the _image_rodata_start and _image_rodata_end symbols to NIOS2's linker script. Signed-off-by: Daniel Leung <[email protected]>
This adds the _image_rodata_start and _image_rodata_end symbols to SPARC's arch linker script. Signed-off-by: Daniel Leung <[email protected]>
NIOS2, RISC-V and SPARC are using _image_rodata_start/_end in their linker scripts to mark the boundaries of rodata. So they no loner need special treatment. Signed-off-by: Daniel Leung <[email protected]>
NIOS2 is using _image_rodata_start/_end in its linker script to mark the boundaries of rodata. So they no loner need special treatment. Signed-off-by: Daniel Leung <[email protected]>
This adds dictionary based logging support. Dictionary based logging is binary based where one big difference is that static strings are stored as pointers instead of the whole string. This results in reduced space requirements for storing log messages in certain scenairos. Signed-off-by: Daniel Leung <[email protected]>
4210223 to
cfc5e36
Compare
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.
Looks very good. Thanks for the cleanup into a choice.
Two minor nits.
This adds a new UART backend for dictionary based logging, where this can output binary data in both binary and hexidecimal strings. Signed-off-by: Daniel Leung <[email protected]>
This adds a sample application on dictionary-based logging. The README file includes instruction on how to run the log parser to generate human readable log messages. Signed-off-by: Daniel Leung <[email protected]>
This adds new documentation for dictionary-based logging on usage and low-level information. Signed-off-by: Daniel Leung <[email protected]>
cfc5e36 to
d4163bf
Compare
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
|
Dictionary for printk() in the Linux kernel: |
Dictionary-based logging, instead of human readable texts, outputs the log messages in binary format. This binary format encodes arguments to formatted strings in their native storage formats which can be more compact than their text equivalents. For statically defined strings (including the format strings and any string arguments), references to the ELF file are encoded
instead of the whole strings. A dictionary created at build time contains the mappings between these references and the actual strings. This allows the offline parser to obtain the strings from the dictionary to parse the log messages. This binary format allows a more compact representation of log messages in certain scenarios. However, this requires the use of an offline parser and is not as intuitive to use as text-based log messages.