Task Execution time measurement on Keil for STM32F103
Welcome to EE StackExchange.

I'm not familiar with Keil tools, but a quick internet search yields this, so the answer is Yes.

A practical approach would be to use an GPIO and an oscilloscope.

Set the GPIO high when entering you function/task and low when exiting.

Connect the scope probe to the GPIO and you can measure the execution time and frequency of your function/task.