I think this should work:
#include <time.h>
clock_t start = clock(), diff;
ProcessIntenseFunction();
diff = clock() - start;
int msec = diff * 1000 / CLOCKS_PER_SEC;
printf("Time taken %d seconds %d milliseconds", msec/1000, msec%1000);
More Related Contents:
- how to show time performance for merge sort? [closed]
- Improve INSERT-per-second performance of SQLite
- Is DateTime.Now the best way to measure a function’s performance? [closed]
- Why does the order of the loops affect performance when iterating over a 2D array?
- Is there a performance difference between i++ and ++i in C?
- Stopwatch vs. using System.DateTime.Now for timing events [duplicate]
- In an OpenMP parallel code, would there be any benefit for memset to be run in parallel?
- Which ordering of nested loops for iterating over a 2D array is more efficient [duplicate]
- How do I measure a time interval in C?
- Loop with function call faster than an empty loop
- Is a Recursive-Iterative Method Better than a Purely Iterative Method to find out if a number is prime?
- Why vectorizing the loop does not have performance improvement
- How to do unsigned saturating addition in C?
- Is Fortran easier to optimize than C for heavy calculations?
- How to get 100% CPU usage from a C program
- Measuring Cache Latencies
- Cache size estimation on your system?
- Getting an accurate execution time in C++ (micro seconds)
- Do temp variables slow down my program?
- Why is memcmp so much faster than a for loop check?
- How to use timer in C?
- Concatenating strings in C, which method is more efficient?
- faster alternative to memcpy?
- Algorithm to find all the exact divisors of a given integer
- Which is better way to calculate nCr
- Faster approach to checking for an all-zero buffer in C?
- Inline function v. Macro in C — What’s the Overhead (Memory/Speed)?
- Is x += 1 more efficient than x = x + 1?
- Why vectorizing the loop over 64-bit elements does not have performance improvement over large buffers?
- How much overhead can the -fPIC flag add?