Baremetal app time measurement using HWlib seems not accurate - Baremetal app time measurement using HWlib seems not accurate Hi, I'm using the Intel HWlib for measuring some steps execution time on the Arrive V SoC HPS (Arm CPU). The problem is that I'm suspecting for getting unrealistic results. The code is as follows: 1. /* Initialize and start timer (counter) for 9 seconds */ socfpga_timer_start(ALT_GPT_CPU_PRIVATE_TMR, 9000); 2. 10 Iterations loop: 2.1. /* get current counter value */ counter_val = alt_gpt_counter_get(ALT_GPT_CPU_PRIVATE_TMR); 2.2. /* 1 second delay */ alt_gpt_delay_ns(ALT_GPT_CPU_PRIVATE_TMR, counter_val, 1000000000) 2.3. /* start measure time */ start_time = alt_gpt_curtime_microsecs_get(ALT_GPT_CPU_PRIVATE_TMR); 2.4. /* perform step1 calculations */ . . 2.5 /* stop measure time */ end_time = alt_gpt_curtime_microsecs_get(ALT_GPT_CPU_PRIVATE_TMR); 2.6. /* calculate step 1 execution time */ printf("\n elapsed time = %" PRIu32 "microsec\n" , t_start-t_end); 3.1. /* start measure time */ start_time = alt_gpt_curtime_microsecs_get(ALT_GPT_CPU_PRIVATE_TMR); 3.2. /* perform step2 calculations */ . . 3.3 /* stop measure time */ end_time = alt_gpt_curtime_microsecs_get(ALT_GPT_CPU_PRIVATE_TMR); 3.4. /* calculate step 2 execution time */ printf("\n elapsed time = %" PRIu32 "microsec\n" , t_start-t_end); * The counter doesn't reach 0 during these measurments * I fear that I'm getting too long results for each measurement. Is there something wrong with my code? Thanks Replies: Re: Baremetal app time measurement using HWlib seems not accurate Hi Since this thread been resolve, I shall set this thread to close pending. If you still need further assistance, you are welcome reopen this thread within 20days or open a new thread, some one will be right with you. Please login to ‘ https://supporttickets.intel.com’ , view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions. If you happened to close this thread you might receive a survey. If you think you would rank your support experience less than 10 out of 10, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience. Regards Jingyang, Teh Replies: Re: Baremetal app time measurement using HWlib seems not accurate Thank you very much Replies: Re: Baremetal app time measurement using HWlib seems not accurate Hi bsp_user Sorry for the confusion. I thought you were implying that the api are not returning an inaccurate results. Yeah. The usage of the API are correct. Regards Jingyang, Teh Replies: Re: Baremetal app time measurement using HWlib seems not accurate Hi JingyangTeh, I apologies, I didn't understand what you mean. In my code I actually do something during step 1 (2.4) and step 2 (3.2). I didn't post here what I'm doing. the results I get are actually in microseconds. I just wanted to ask here if the measurement logic is correct since its my first time using HWlibs to perform some calculations execution time measurements. Replies: Re: Baremetal app time measurement using HWlib seems not accurate HI bsp_user Is it possible if you could share with us the results that you got for the code you shared? Just to confirm we are aligned, for steps 2.6 and step 3.4 we are expecting an elapsed time of 9 seconds and 90 seconds respectively? Regards Jingyang, Teh - 2023-04-30

external_document