This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Replies: 8
Views: 220
Part Number: TMDXIDK5718
Tool/software: Code Composer Studio
I am creating a boot program for MPU (A15) using "TMDXIDK5718".I want to measure the processing time of a function in a program.
I tried the following code, but the return value of the “clock” function was always “0xFFFFFFFF”.
clock_t start = clock(); func(); clock_t end = clock();
I think I should use the "Performance Monitor Count" register.But I don't know what code to write.Could you provide a sample code like the one above?
Thank you.
Hi,
Your query has been assigned to a TI engineer. Please note that feedback may be delayed due to holidays in the USA.
In reply to Biser Gatchev-XID:
For CSL (bare-metal), please see the following files:
These functions are provided for PMU: ARM_CCNT_Enable, ARM_CCNT_Reset, ARM_CCNT_Read. I think you would simply call ARM_CCNT_Read() before (start) and after (end) your function call.
Please see this thread for using A15 PMU as a time stamp provider in an RTOS-based application:
https://e2e.ti.com/support/processors/f/791/t/617492?DRA756-A15-example-of-timestamp-provider-in-core-clock-cycles
Regards,Frank
In reply to Frank Livingston:
Thank you for your reply.The following code was able to get a value like processing time.
unsigned int start_time, end_time; ARM_CCNT_Enable(); start_time = ARM_CCNT_Read(); func(); end_time = ARM_CCNT_Read();
start_time = 0
end_time = 18052The result was obtained.
How can I convert this "18052" to milliseconds?
In reply to koji fukumoto:
Please see the header in performance_unit.asm:
* The CCNT is divided by 64 (by setting Bit 3 of PMNC to 1)* CCNT Read returns the clock value divided by 64 cycles.* To get the actual CPU cycle multiple it with 64
You can confirm the PMU Cycle Counter is configured this way be inspecting the assembly code in performance_unit.asm. To understand the code, please refer to relevant ARM documentation, e.g.
To get a time in msec.:
Hi,Thank you for your reply.
The CPU clock of TMDXIDK5718 is 1.5GHz.Is the following calculation method correct?
unsigned int start_time, end_time; double procMS; ARM_CCNT_Enable(); start_time = ARM_CCNT_Read(); func(); end_time = ARM_CCNT_Read(); procMS = (end_time - start_time) * 64.0 / 1610612736.0 * 1000.0;
I would multiply by 1.5e6 rather than 1.5*1024^3.
It is confirmation just in case.Is it “1.5e6” instead of “1.5e9”?(Is "1,500,000" instead of "1,500,000,000"?)
Yes, it should be 1.5e9 (Giga), not 1.5e6 (Mega).