Forum Discussion

Chris039's avatar
Chris039
Icon for Occasional Contributor rankOccasional Contributor
3 years ago

How to calculate the time for running the code in Nios II and Nios V?

Hi,

How do I calculate the time used for executing a command in Nios II and Nios V.

I was using the example in the below link but the results from Nios II and Nios V are different.

https://cplusplus.com/reference/ctime/clock/

-------------------------------------------------------------------------------------------------------

clock_t t;

t = clock();
printf ("Calculating...\n");

... (Anything, or you may put usleep (1000000)

...

...

t = clock() - t;

printf ("It took me %ld clicks (%f seconds).\n",t,((float)t)/1000000);
printf ("It took me %u clicks (%x seconds).\n",t,((float)t)/1000000);

-------------------------------------------------------------------------------------------------------

Nios II

Nios V

Could you share the way to calculate the time taken for running a piece of code in Nios V?

Thanks

17 Replies