Code Profiling tools

Is there any documentation on how to use GPROF or VALGRING or similar tool on the WP7702 ?
I am running 15.1.0.004 Legato 21.05.0
I am trying to see where my code spends the most time.
Thanks

You can see here

Thanks
Did as described it’s a newer version ? but get a permission denied when try to run?

pm@pmFX30S:/media/psf/Home/mango/valgrind21/valgrind$ scp ./3.15.0-r0/image/usbin/* root@192.168.2.2:/tmp/valgrind
callgrind_annotate 100% 44KB 1.9MB/s 00:00
callgrind_control 100% 12KB 1.7MB/s 00:00
cg_annotate 100% 33KB 2.5MB/s 00:00
cg_diff 100% 10KB 1.4MB/s 00:00
cg_merge 100% 176KB 3.5MB/s 00:00
ms_print 100% 24KB 1.9MB/s 00:00
valgrind 100% 94KB 3.4MB/s 00:00
valgrind-di-server 100% 104KB 3.5MB/s 00:00
valgrind-listener 100% 29KB 3.0MB/s 00:00
vgdb 100% 148KB 3.7MB/s 00:00
pm@pmFX30S:/media/psf/Home/mango/valgrind21/valgrind$ scp ./3.15.0-r0/image/usr/lib/valgrind/memcheck-arm-linux root@192.168.2.2:/tmp/valgrind
memcheck-arm-linux 100% 12MB 4.2MB/s 00:02
pm@pmFX30S:/media/psf/Home/mango/valgrind21/valgrind$ scp ./3.15.0-r0/image/usr/lib/valgrind/callgrind-arm-linux root@192.168.2.2:/tmp/valgrind
callgrind-arm-linux 100% 11MB 4.1MB/s 00:02

root@fx30s:/tmp/valgrind# /tmp/valgrind/valgrind
-sh: /tmp/valgrind/valgrind: Permission denied
root@fx30s:/tmp/valgrind# ls -l
-rwxrwxrwx 1 root root 11529460 May 23 08:56 callgrind-arm-linux
-rwxrwxrwx 1 root root 44737 May 23 08:55 callgrind_annotate
-rwxrwxrwx 1 root root 12673 May 23 08:55 callgrind_control
-rwxrwxrwx 1 root root 33535 May 23 08:55 cg_annotate
-rwxrwxrwx 1 root root 10418 May 23 08:55 cg_diff
-rwxrwxrwx 1 root root 180064 May 23 08:55 cg_merge
-rwxrwxrwx 1 root root 12747592 May 23 08:56 memcheck-arm-linux
-rwxrwxrwx 1 root root 24398 May 23 08:55 ms_print
-rwxrwxrwx 1 root root 96576 May 23 08:55 valgrind
-rwxrwxrwx 1 root root 106468 May 23 08:55 valgrind-di-server
-rwxrwxrwx 1 root root 29564 May 23 08:55 valgrind-listener
-rwxrwxrwx 1 root root 151320 May 23 08:55 vgdb

How about “chmod 777 /tmp/valgrind/valgrind”?
Not sure if you need to rebuild according to your FW version R15.

BTW, I can run on wp77 firmware R14.1.
https://source.sierrawireless.com/resources/airprime/software/wp77xx/wp77xx-firmware-release-14,-d-,1/#sthash.drUWPqGm.dpbs



root@fx30:~# mkdir /tmp/valgrind
root@fx30:~# mkdir /tmp/tmp_lib;mkdir /tmp/tmp_lib_wr;
root@fx30:~# cp -rf /lib /tmp/tmp_lib
root@fx30:~# mount -t overlay overlay /lib -o lowerdir=/lib,upperdir=/tmp/tmp_li
b,workdir=/tmp/tmp_lib_wr;
root@fx30:~# chmod -R 777 /tmp/valgrind
root@fx30:~# export VALGRIND_LIB=/tmp/valgrind
root@fx30:~# cd /tmp/valgrind/
root@fx30:/tmp/valgrind# ./valgrind --leak-check=full --show-leak-kinds=all  --v
erbose ./vgdb
==2716== Memcheck, a memory error detector
==2716== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2716== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==2716== Command: ./vgdb
==2716==
--2716-- Valgrind options:
--2716--    --leak-check=full
--2716--    --show-leak-kinds=all
--2716--    --verbose
--2716-- Contents of /proc/version:
--2716--   Linux version 3.18.140 (oe-user@oe-host) () #1 PREEMPT Fri May 14 11:13:23 UTC 2021
--2716--
--2716-- Arch and hwcaps: ARM, LittleEndian, ARMv7-neon-vfp
--2716-- Page sizes: currently 4096, max supported 4096
--2716-- Valgrind library directory: /tmp/valgrind
--2716-- Reading syms from /tmp/valgrind/vgdb
--2716-- Reading syms from /lib/ld-2.27.so
--2716-- Reading syms from /tmp/valgrind/memcheck-arm-linux
--2716--    object doesn't have a dynamic symbol table
--2716-- Scheduler: using generic scheduler lock implementation.
--2716-- Reading suppressions file: /tmp/valgrind/default.supp
==2716== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-2716-by-root-on-???
==2716== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-2716-by-root-on-???
==2716== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-2716-by-root-on-???
==2716==
==2716== TO CONTROL THIS PROCESS USING vgdb (which you probably
==2716== don't want to do, unless you know exactly what you're doing,
==2716== or are doing some strange experiment):
==2716==   /tmp/valgrind/../../bin/vgdb --pid=2716 ...command...
==2716==
==2716== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==2716==   /path/to/gdb ./vgdb
==2716== and then give GDB the following command
==2716==   target remote | /tmp/valgrind/../../bin/vgdb --pid=2716
==2716== --pid is optional if only one valgrind process is running
==2716==
--2716-- REDIR: 0x401a781 (ld-linux.so.3:strlen) redirected to 0x5805721c (???)
--2716-- REDIR: 0x401b300 (ld-linux.so.3:memcpy) redirected to 0x58057248 (???)
--2716-- REDIR: 0x401a071 (ld-linux.so.3:strcmp) redirected to 0x58057354 (???)
--2716-- Reading syms from /tmp/valgrind/vgpreload_core-arm-linux.so
--2716-- Reading syms from /lib/libpthread-2.27.so
--2716--   Considering /lib/libpthread-2.27.so ..
--2716--   .. CRC mismatch (computed 625f8b61 wanted 7bccdfac)
--2716--    object doesn't have a symbol table
--2716--   Reading EXIDX entries: 83 available
==2716==   Warning: whilst reading EXIDX: Implausible EXIDX last entry size 4294967199; using 1 instead.
--2716--   Reading EXIDX entries: 69 attempted, 69 successful
--2716-- Reading syms from /lib/libc-2.27.so
--2716--   Considering /lib/libc-2.27.so ..
--2716--   .. CRC mismatch (computed ffa2c805 wanted add05a1e)
--2716--    object doesn't have a symbol table
--2716--   Reading EXIDX entries: 726 available
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryExtract: bytecode can't be represented
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==2716==   Warning: whilst reading EXIDX: Implausible EXIDX last entry size 4294964239; using 1 instead.
--2716--   Reading EXIDX entries: 527 attempted, 421 successful
==2716== Conditional jump or move depends on uninitialised value(s)
==2716==    at 0x48E0B00: strlen (in /lib/libc-2.27.so)
==2716==
==2716== Use of uninitialised value of size 4
==2716==    at 0x48E033C: strcpy (in /lib/libc-2.27.so)
==2716==
Using vgdb standalone implies to give -D or -l or a COMMAND
args error. Try `vgdb --help` for more information
==2716==
==2716== HEAP SUMMARY:
==2716==     in use at exit: 0 bytes in 0 blocks
==2716==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2716==
==2716== All heap blocks were freed -- no leaks are possible
==2716==
==2716== Use --track-origins=yes to see where uninitialised values come from
==2716== ERROR SUMMARY: 12 errors from 2 contexts (suppressed: 3 from 3)
==2716==
==2716== 1 errors in context 1 of 2:
==2716== Conditional jump or move depends on uninitialised value(s)
==2716==    at 0x48E0B00: strlen (in /lib/libc-2.27.so)
==2716==
==2716==
==2716== 11 errors in context 2 of 2:
==2716== Use of uninitialised value of size 4
==2716==    at 0x48E033C: strcpy (in /lib/libc-2.27.so)
==2716==
--2716--
--2716-- used_suppression:      3 dl-hack3-cond-1 /tmp/valgrind/default.supp:1236
==2716==
==2716== ERROR SUMMARY: 12 errors from 2 contexts (suppressed: 3 from 3)
root@fx30:/tmp/valgrind# cm info
Device:                        WP7702
IMEI:                          352653090612345
IMEISV:                        6
FSN:                           VU213430812345
Firmware Version:              SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
Bootloader Version:            SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
MCU Version:                   002.015
PRI Part Number (PN):          9908741
PRI Revision:                  002.001
Carrier PRI Name:              GENERIC
Carrier PRI Revision:          001.071_001
SKU:                           1104214
Last Reset Cause:              Power Down
Resets Count:                  Expected: 123    Unexpected: 0
root@fx30:/tmp/valgrind# legato version
19.11.5.a1621d58_27c4cd8552e17e79fdc3b0c91ff8bce9