[riot-devel] gprof for non-native boards

Daniel Krebs mail at daniel-krebs.net
Mon Aug 22 15:49:51 CEST 2016


Hi Martine,

if your just interested in the call path and speed is no concern, I
imagine that you could implement this relatively easy on your own. GCC
can generate hooks for each function call [1] that you could use to
print directly via serial and later resolve names using the linker map file.

However, you won't be able to get meaningful benchmarks as this would
slow down the code *a lot*. Still, if you're interested in statistics
about which functions your code visted the most, kCacheGrind is a nice
tool for visualization with a really simple syntax.

Not long ago I needed a profiler for an x86 OS (no Linux!) and also had
a look at gmon/gperf. At that time, it seemed easier to integrate XRay
[3] into my project, but I guess this will not fit for an embedded target.

Cheers,
Daniel

[1]
https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Code-Gen-Options.html#index-finstrument_002dfunctions-1625
[2] https://kcachegrind.github.io/html/Home.html
[3]
https://chromium.googlesource.com/chromium/src/+/master/native_client_sdk/src/libraries/xray

Am 22.08.2016 um 15:16 schrieb Martine Lenders:
> Hi,
> for stack memory optimizations in GNRC I need some kind of tool to
> analyze the call-path of its threads (the stackusage of each function
> itself can easily determined using GCC [1]). After some experiments
> with some static solutions (I basically went through the list here
> [2]) I wasn't able to come to a satisfying result, so I want to go for
> a run-time solution. However, we have (undocumented) support for gprof
> on native [3]. Has anyone experience with gprof on non-native boards?
> What tools do I need to install besides the respective gprof-version?
> How do I connect gprof to the board?
> 
> Cheers,
> Martine
> 
> [1] https://gcc.gnu.org/onlinedocs/gnat_ugn/Static-Stack-Usage-Analysis.html
> [2] https://en.wikipedia.org/wiki/Call_graph#Free_software_call-graph_generators
> [3] https://github.com/RIOT-OS/RIOT/blob/master/boards/native/Makefile.include#L156-L159
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
> 


More information about the devel mailing list