I have one code for image compression alogrithm in c++. For my part, I have to measure execution time of different parts of algorithm. I am using clock() to measure time. But the probelm is that elapsed time is always zero. That is both begin time and end time are always same. While the calculation code between begin and end time is not small, it is transformation calculation. So there should be some elapse time for this part. I am postimg the part of the code that contains time measurement code because program is too big to post and explain.
********************************************
some class(){
double elapTime;
clock_t beginT, endT;
isFloat = type < 8 ? false : true;
if(isFloat) type -= 8;
I am sure the code is correct because it records begin and end time in test_results file. But why these both values are always same? Can anyone help me with this problem?
clock() return the number of ticks since the beginning of the program. endT-beginT is the number of clocks between the two calls to clock(), so I can't imagine what you were thinking when you wrote that expression.
You can get the time in seconds with float(clock())/float(CLOCKS_PER_SEC).
I don't have any previous experience with c++. I have taken help from web about clock(). Please Can you tell me which expression are you talking about from my part ?
That I doubt. I assume that it should take atleast 1 ms to do complex wavelet transformation on 256 * 256 image. Is there any otherway that I can measure time in resolution smaller than 1ms or in ns?