Hi.
I have a task to optimize the memory manager. to do this, I want to measure the performance of individual functions and parts of the code in the kernel.
What is the easiest way to implement this task?
Thanks.
How easy is it to measure the function's running time?
Re: How easy is it to measure the function's running time?
Have a function that returns a strictly and monotonely increasing counter. This could be an absolute timestamp, but also a CPU-freq dependent counter. Both x86 and ARM has such a built-in counter, which does not rely on any peripherals. As long as all comparitions are made using the same counter, the actual unit doesn't really matter (but SI units like nanosec are better on the long run and necessary to compare your code running on different machines).mrjbom wrote:Hi.
I have a task to optimize the memory manager. to do this, I want to measure the performance of individual functions and parts of the code in the kernel.
What is the easiest way to implement this task?
Thanks.
Then you use the function like this, calling it twice, before and after the code you want to measure:
Code: Select all
start = ticks();
/* ... code to be measured ... */
printf("time: %d\n", ticks() - start);
bzt