Is there a clean Windows port / version of the /usr/bin/time
command in Linux (program to time the execution of a process)?
7 Answers
I have created a simple Windows program called timemem.exe that behaves similarly to /usr/bin/time on Linux/Mac OS X, and will show similar statistics, such as elapsed time, user and kernel CPU time, and maximum working set size in memory used by another Win32 process. See:
If you want time
to use it as a benchmark utility, the Windows 2003 Resource Kit has Timeit.exe
which does the same.
-
-
Unfortunately that seems to be the only download Microsoft provides. But there are a lot of useful tools in there which I have renamed to their UNIX equivalent and dropped into my System32 folder for use from the command line. You can simply delete the ones which you don't want.– John TAug 28, 2009 at 0:50
-
John T, congrats on being first to 10k! Enjoy reading your posts... Don't know how you find the time as every time I am about to submit, you seem to have the same / slightly better answer! Here's to the next 10k!- Delete this after you have read it as there is no private message feature! (or write another commend then il delete it) Aug 28, 2009 at 1:59
-
@Wil, thanks! I cannot delete it and there is no need to. Comments are exactly that, comments. Good ones are rather appreciated :)– John TAug 28, 2009 at 5:18
You could always install Cygwin which will give you the UNIX time command. It is pretty useful to have Cygwin installed anyway.
By you asking for a clean port or version, I don't think Cygwin would be acceptable. The only thing I have found is this for custom code to compile on Windows. As I didn't find any links where this has been set up as the time command, I don't know that you could get this to work unless you wanted to program it yourself.
A bit late to the party, but I was searching for a Windows version of /usr/bin/time. Could not find anything, so I wrote a clone:
https://github.com/cbielow/wintime
It can measure
- execution time of a program
- RAM usage (maximum)
- page faults etc...
including logging to a CSV file. Precompiled binaries are available. Just download and run it.
On my Mac, /usr/bin/time
returns the system uptime.
On a Windows computer, you can use the following to return the uptime: net stats server
The 'Statistics Since' will give you the time the computer was last powered up. There's also a server tool - uptime.exe
There's more information at the Microsoft Support Site.
Of course, if you're not looking to find the uptime of a computer, I'm way off the mark. If you're not looking for uptime, what are you looking to achieve?
Edit: If you're looking for CPU time as suggested in a comment, you can use the tasklist
command. Punch in tasklist /?
at a command prompt and see the info about it.
-
1I don't think he's looking for uptime. time on linux measures the real and cpu time for a process. Aug 28, 2009 at 0:38
-
@prestomation: Ah. Edited, adding something else that would help. Aug 28, 2009 at 0:48
PowerShell already has the built-in capability to measure runtime with the cmdlet Measure-Command
Measure-Command { Get-EventLog "windows powershell" }
Of course it can also be called from cmd or any applications
powershell -C "Measure-Command { sleep 2 }"
/usr/bin/time
are you looking for on Windows, specifically?time
actually does on Linux. Someone may not use Linux, but may know a Windows Alternative to what you're looking for (which is the ultimate goal of your question) - it would be helpful for those people to state what you're looking to achieve.timethis.exe
which does what you want and is available as an approx 116K download.