N/APosted on - 02/15/2012
To create my own one I need each of code or instruction to get that in the execution lifetime of a C/C++ program.
For selecting data from memory to the CPU how many times it goes to the memory and by data pitching procedure how much time is in use?
Please give me a solution.
Thanks in advance.
Execution lifetime of a C/C++ program
To calculate the time a ‘C’ code takes to go from memory to the CPU and back again , in short the required to execute the program can be calculated by the following function.
You call in the ‘clock’ function from the lib.
clock_t tStart = clock();
** Write your code here**
printf("Time taken: %.2fsn", (double)(clock() – tStart)/CLOCKS_PER_SEC);
Just run the program and at the end , along with the result it will also display the time it took your code to complete the full cycle of execution.