What is the windows analog to unix time command?
|
feedback
|
migrated from stackoverflow.com Dec 28 '09 at 5:11
This question came from our site for professional and enthusiast programmers.
|
This is a duplicate of an older question on stackoverflow - see there for many answers :) | |||
|
feedback
|
|
You can use timeit.exe from the Windows Server 2003 Resource Kit. Syntax: timeit [-f FileName] [-a] [-c] [-i] [-d] [-s] [-t] [-k KeyName | -r KeyName] [-m Mask] [Command] -f FileName Specifies the name of the database file where TimeIt keeps a history of previous timings. The default file name is .\Timeit.dat -k KeyName Specifies the keyname to use for this timing run. -r KeyName Specifies the key name to remove from the database. If the key name is followed by a comma and a number, the slowest time (positive number) or the fastest time (negative number) for that key name will be removed. -a Specifies that TimeIt should display average of all timings for the specified key name. -i Ignores nonzero return codes from the program run by TimeIt. -d Shows detail for average. -s Suppresses systemwide counters. -t Specifies tabular output. -c Forces a re-sort of the database. -m Mask Specifies the processor affinity mask. Command Specifies the command to time. | |||||||||||
feedback
|
|
Write a C program using the GetProcessTimes function, you could find its documentation in: http://msdn.microsoft.com/en-us/library/ms683223%28VS.85%29.aspx. In the examples of the book "Windows System Programming" comes a program that use that function to retrieve exactly what you need(Elapsed, Kernel, User times). The program is call "timep.exe" and it can be found in the runX subdirectories (the X comes from the version of Visual Studio used in the compilation) inside the zipped examples archive. Here is the author page from where you could download that archive http://www.jmhartsoftware.com/, of course the source code is also there so you could see exactly how timep.exe works. | |||
|
feedback
|