Hello!

I have coded a compression technique and I am having trouble in measuring the speed of it. I tried to generate log of start time and end time, but compression time of same file varies a lot under windows. That may be happening because other processes would be consuming resources my program could me in blocked mode for a while. Can anyone please suggest me a way to measure the execution time of my program minus the waiting time when it was blocked?

I can think of three possible ways

(1) Setup a minimal Linux and run my program there so that no other process would interfere my program.

(2) Use some tool that would help me generate the report about the execution of my program.

(3) Code my program in such a way that it would tell me the absolute execution time at the end of compression.

Please guide me...

If you use the clock() function, it will return the clock ticks elapsed by your process only. My guess is that you have been using a general local-time function like "time()" to measure your elapsed times. The time() function and the clock() function are fundamentally different in the sense that clock() return the number of clock-ticks since the start of the calling process and only the clock-ticks consumed by the calling process are counted. In other words, if you use the clock function, there should be no variability introduced by having other processes running on the computer.

N.B. When measuring performance of algorithms that do file I/O, always expect variability just from the fact that file I/O is usually the main bottleneck operation and it is not very steady.

>> Do you agree this would work?

It would certainly help. It wouldn't completely solve the problem, RAM is also variable in access time, but certainly not as much as the HD.

Anyways, what is wrong with variability? What is wrong with taking statistics on the performance of your algorithm? You run it multiple times and take the average running time as the performance value you are looking for. What's wrong with that?

@theprofoundgeek (thread starter)
I am having similar issue on windows vista. Not able to calculate the time my program took to complete.
Would you please paste your code(only related to time calculation) here, in case you solved the issue?

Edited 5 Years Ago by ExpertsGuide: n/a

This article has been dead for over six months. Start a new discussion instead.