huojianchaoyy opened a new pull request, #22302: URL: https://github.com/apache/nuttx/pull/22302
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Fixes of the noteram text dump (`trace dump`, `cat /dev/note/ram`) from Xiaomi Vela. - **drivers/note/noteram_driver.c: modify the trace print format for perfetto**: a printf note is written as an instant event, `tracing_mark_write: I|<pid>|<message>`, like the wdog notes, instead of a bare `tracing_mark_write: <message>` that is none of the marker forms the dump uses for its other events. - **note: fix sched_note_printf newline error**: `noteram_dump_printf()` ended the line only for a note printed from its argument types (`npt_type != 0`). A note printed through its format string got no newline, and the next record of the dump continued on the same line. The newline is now written after every printf note. - **noteram: fix compile warnings**: the heap note prints the `size_t` fields of `struct note_heap_s` with `%zu`; GCC warned about the `%d` on 64-bit targets. ## Impact - Only the text output of the noteram dump changes; the binary dump and the notes themselves do not. - printf notes: `tracing_mark_write: <message>` becomes `tracing_mark_write: I|<pid>|<message>`, one per line. A format string that ends with `\n` itself now leaves an empty line after the note. - No API, Kconfig or default value change. ## Testing Host: Ubuntu 22.04 x86_64, GCC 13.4.0 (sim), Arm GNU Toolchain 13.2.rel1, CMake 3.23 + Ninja 1.10. Base: master f284e6d7a75. `./tools/checkpatch.sh -c -u -m -g HEAD~3..HEAD` passes. Every commit builds (CMake, incremental) for `sim:note` with `SCHED_INSTRUMENTATION_HEAP`, `SCHED_INSTRUMENTATION_WDOG` and `SCHED_INSTRUMENTATION_DUMP`, with and without `DRIVERS_NOTERAM_TEXT_DUMP`. With the text dump, master and the first two commits warn ``` drivers/note/noteram_driver.c:1305:71: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=] ``` and "noteram: fix compile warnings" removes the warning. The head also builds for `qemu-armv7a:nsh` with noteram and the same notes, and with Make for `sim:note`. `sim:note` with the options above, `EXAMPLES_NOTEPRINTF` and hostfs: `noteprintf &`, `trace start`, `sleep 1`, `trace stop`, `trace dump /host/a.txt`. master: the printf notes have no newline and run into the next record ``` noteprintf-6 [0] 16.710309112: tracing_mark_write: 5noteprintf-6 [0] 16.710310185: tracing_mark_write: 6noteprintf-6 [0] ... ``` this PR: 1182 printf notes, one per line ``` noteprintf-10 [0] 16.740252520: tracing_mark_write: I|10|7 noteprintf-10 [0] 16.740253167: tracing_mark_write: I|10|8 ``` The heap and wdog lines keep the format of master. The branch merges cleanly with #16369, the only open PR that touches `noteram_driver.c`. Not tested: real hardware; loading the text dump into Perfetto. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
