Is there a clean Windows port / version of the /usr/bin/time command in Linux (program to time the execution of a process)?
-
What feature of `/usr/bin/time` are you looking for on Windows, specifically? – EvilChookie Aug 28 '09 at 00:49
-
The ability to time my programs of course. – unknown Aug 28 '09 at 00:53
-
4Your question assumes that people know what `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. – EvilChookie Aug 28 '09 at 01:40
-
I agree with EvilChookie. +1 now that I understand what you want. – Sasha Chedygov Aug 28 '09 at 03:15
-
Please see my answer for a link to `timethis.exe` which does what you want and is available as an approx 116K download. – Sinan Ünür Aug 28 '09 at 03:21
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:
- 31
- 1
If you want time to use it as a benchmark utility, the Windows 2003 Resource Kit has Timeit.exe which does the same.
- 163,373
- 27
- 341
- 348
-
-
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 T Aug 28 '09 at 00: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) – William Hilsum Aug 28 '09 at 01:59
-
@Wil, thanks! I cannot delete it and there is no need to. Comments are exactly that, comments. Good ones are rather appreciated :) – John T Aug 28 '09 at 05:18
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.
- 121
- 1
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.
- 2,536
- 2
- 19
- 18
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.
- 26,555
- 15
- 113
- 235
- 4,569
- 1
- 25
- 34
-
1I don't think he's looking for uptime. time on linux measures the real and cpu time for a process. – prestomation Aug 28 '09 at 00:38
-
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 }"
- 26,555
- 15
- 113
- 235