This tip was printed from the MalekTips Computer and Technology Help and Tips website at http://malektips.com.

Windows XP and DOS - Use NTimer to Display How Long a Program Takes to Execute

SUMMARY: Benchmark how long it takes a process to run under Windows XP from the DOS prompt.

When developing applications or testing scripts in Windows XP, it may prove beneficial to benchmark how much time it takes for the particular code to execute. Perhaps you need to test different sorting or cache file management algorithms to learn which one is quickest. You may want to record how long it takes website analysis software to parse server log files. For these and other purposes you can use the Windows XP ntimer command.

The ntimer command displays detailed information on elapsed time, user mode time, kernel mode time, and privileged mode time. As the help file states, the timing is only accurate up to the resolution of the computer's internal timer, which on x86-based machines is to the tenth of a second.

To use the ntimer command, you'll need to first download and install the Windows 2003 Resource Kit.

The ntimer command supports the following command-line options:

-1
Display output on one line, suppressing some of the information

-f
Displays process page faults, total system interrupts, context switches, and system calls

-s
Allows you to time a server process - press CONTROL+C in the DOS prompt window to get the current timing information.

program name and parameters
REQUIRED - The program name to execute and any required command-line parameters.

Example:

The following example would run the "parselogs" application and show how much time it took to execute. Note that "parselogs" is a fictional command.

ntimer parselogs

The output may look something like this:

ContextSwitches - 34181
First level fills = 0
Second level fills = 0

ETime( 0:00:18.196 ) UTime( 0:00:00.600 ) KTime( 0:00:09.894 )
ITime( 0:00:06.909 )


 


Press the "print" button on your browser or select "File" - "Print" to print this tip. Then, return to Windows XP and DOS - Use NTimer to Display How Long a Program Takes to Execute
 
Standard disclaimer applies - read http://malektips.com/disclaim.html.