chirping78 opened a new pull request, #17479: URL: https://github.com/apache/nuttx/pull/17479
## Summary Add the implementation of `_mcount()` to meet the requirements of gprof. ## Impact xtensa/gprof ## Testing ### test the flat profile (does not depend on this PR) 1. use `esp32s3-devkit:nsh` as example, enable these config items ``` # for gprof CONFIG_PROFILE_MINI=y CONFIG_SYSTEM_GPROF=y # for save and transfer CONFIG_FS_TMPFS=y CONFIG_SYSTEM_YMODEM=y ``` 2. build & flash 3. collect the information that gprof needs ``` nsh> gprof start nsh> gprof stop # do some test here, such as ostest nsh> gprof dump /tmp/gmon.out nsh> sb /tmp/gmon.out ``` 4. receive the file on PC, and run gprof to interpret the information ``` $ cp nuttx nuttx_prof $ xtensa-esp32s3-elf-objcopy -I elf32-xtensa-le --rename-section .flash.text=.text nuttx_prof $ xtensa-esp32s3-elf-gprof nuttx_prof gmon.out ``` ### test the call graph profile (depends on this PR) 1. add compiler option `-pg` to the component, such as ostest Makefile, like: `CFLAGS += -pg`; see [Details of Profiling](https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html#SEC24) for why 2. enable config item `CONFIG_FRAME_POINTER=y` The other steps are the same as above. Now with the help of mcount, the call graph can be generated. -- 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]
