I am in the midst of planning for an updated and more accurate antivirus, internet security, total security performance test and one of the test features on measuring the amount of time taken to convert media files and also file compression. There are media converters which shows the total amount of time taken to convert the media files but it only shows second. I wanted a more accurate benchmark time which shows even up to milliseconds but there I couldn’t seem to find any. Finally I figured that I will have to resort to a slightly more sophisticated method in measuring the time taken to complete a command line or batch file execution.
So far I have found 2 command line tools that can accurately measure program execution time and also a good old batch command. Basically we will need to run the batch file or command line after the application that is used to measure the time.
The first tool I found is called ptime for Windows. ptime will run the specified command and measure the execution time (run time) in seconds, accurate to 5 millisecond or better. It is an automatic process timer, or program timer. One usage example is if you want to measure how long it takes to run this command “dir C:/s”, then you should run ptime as “ptime dir c: /s“. Once the dir command has been finished executing, you will see “Execution time: X.XXX s”.
Another similar tool to ptime is called Ultra Precision Command Timer (UPCT) which also works exactly the same as ptime. UPCT can even tell you the measurement in microseconds and seconds. Both ptime and UPCT is very old but it still works on Windows 7.
The more old school way without using any third party tool is to create a batch file and use the %Time% variable to append them to the result file. For example:
ECHO Start Measure %Time% >> timer.txt
YOUR COMMAND GOES HERE
ECHO Stop Measure %Time% >> timer.txt
After running the batch file, you will get a text file called timer.txt showing the date and time before and after running the command line or batch file. Calculate the difference and you have the amount of the time taken to complete the process.
These methods will only work on command line application and not on Windows application with graphical user interface. There in fact another one called Gammadyne’s Timer which belongs to the same category as ptime and upct but for some weird reason it is not capturing the command line parameters. If you want to test it out, you can download it from here.