Entwickler
Newbie level 2
Hello,
I am new to this forum, I am a developer in embedded systems.
I developed an application embedded in c and I am now at code optimization.
Then for the calculation of execution time of a function, I used 2 methods.
The first method, consits of using a LED.
At the beginning of the function I put this LED to 1 then I put this LED to 0 at the end oft he function.
Under this method, the execution time needed for this function is 2.12 µs.
The second method is to calculate the execution time based on the source code of thefunction in assembler (calculation of number of cycles required for execution of code),then taking everything into account gives 0.2 µs.
Then, the execution time of the function by the first method is 2.12 µs and according to the second method is 0.2us.
So my problem is to know why I have not had the same execution time of function in both methods.
How can I find the cause of the difference in execution time function for both methods?and how can I fix it?
Thank you very much
I am new to this forum, I am a developer in embedded systems.
I developed an application embedded in c and I am now at code optimization.
Then for the calculation of execution time of a function, I used 2 methods.
The first method, consits of using a LED.
At the beginning of the function I put this LED to 1 then I put this LED to 0 at the end oft he function.
Under this method, the execution time needed for this function is 2.12 µs.
The second method is to calculate the execution time based on the source code of thefunction in assembler (calculation of number of cycles required for execution of code),then taking everything into account gives 0.2 µs.
Then, the execution time of the function by the first method is 2.12 µs and according to the second method is 0.2us.
So my problem is to know why I have not had the same execution time of function in both methods.
How can I find the cause of the difference in execution time function for both methods?and how can I fix it?
Thank you very much