Performance Profile Interpretation
Posted: Tue May 07, 2024 4:30 pm
I don't have a performance problem. Still, in order to analyze whether there is optimization potential, I used OpenOCD to gather a profile of my app during a typical workload:
So the heaviest 6 functions seem to be
I did not check what these are doing, but I guess they're OS and hardware level management functions that are already heavily optimized.
If I analyze this correctly, then it looks the device is idle most of the time, waiting for peripheral devices to answer.
The first entry that actually shows my application code is way below...
So with 0.26 seconds of a total of 60 seconds which I've captured, I guess all optimization potential is moot.
Code: Select all
gprof ECUconnectOS-s3devkit.elf /tmp/gmon.out
Flat profile:
Each sample counts as 0.0625 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
33.12 21.07 21.07 esp_cpu_stall
21.72 34.89 13.82 esp_cpu_unstall
7.24 39.49 4.61 esp_gpio_reserve_pins
3.34 41.62 2.13 get_call_stack
3.10 43.59 1.97 esp_ptr_dma_ext_capable
2.07 44.91 1.32 esp_cpu_wait_for_intr
1.27 45.72 0.81 xPortEnterCriticalTimeout
1.12 46.43 0.71 spi_hal_setup_trans
1.04 47.09 0.66 esp_event_isr_post_to
1.04 47.75 0.66 spi_hal_prepare_data
0.70 48.20 0.45 esp_cpu_compare_and_set
0.67 48.63 0.43 _WindowOverflow8
0.67 49.05 0.43 _WindowUnderflow8
0.66 49.47 0.42 vPortExitCritical
0.52 49.80 0.33 esp_ptr_byte_accessible
0.51 50.13 0.32 _xt_alloca_exc
0.46 50.42 0.29 _WindowOverflow12
0.41 50.68 0.26 __MCP251XFD_ReadDataNormal
0.39 50.93 0.25 spi_ll_master_set_line_mode
0.38 51.18 0.24 xQueueSemaphoreTake
0.36 51.41 0.23 prvTaskPriorityRestore
0.35 51.63 0.22 pxPortInitialiseStack
0.34 51.84 0.22 tlsf_malloc
0.31 52.04 0.20 __MCP251XFD_WriteDataNormal
0.31 52.24 0.20 spi_ll_write_buffer
0.31 52.44 0.20 vApplicationStackOverflowHook
0.31 52.63 0.19 heap_caps_malloc_base
0.26 52.80 0.17 xTaskGenericNotifyWait
0.26 52.96 0.16 tlsf_free
0.25 53.13 0.16 spi_hal_user_start
0.25 53.29 0.16 _WindowOverflow4
0.25 53.44 0.16 dram_alloc_to_iram_addr
0.23 53.59 0.14 vTaskDelete
0.19 53.71 0.12 systimer_hal_get_counter_value
0.19 53.83 0.12 MCP251XFD_TransmitMessageToFIFO
0.18 53.95 0.12 void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<unsigned char*>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, unsigned char*, std::forward_iterator_tag)
...
Code: Select all
33.12 21.07 21.07 esp_cpu_stall
21.72 34.89 13.82 esp_cpu_unstall
7.24 39.49 4.61 esp_gpio_reserve_pins
3.34 41.62 2.13 get_call_stack
3.10 43.59 1.97 esp_ptr_dma_ext_capable
2.07 44.91 1.32 esp_cpu_wait_for_intr
If I analyze this correctly, then it looks the device is idle most of the time, waiting for peripheral devices to answer.
The first entry that actually shows my application code is way below...
Code: Select all
0.41 50.68 0.26 __MCP251XFD_ReadDataNormal