2

I just want to measure the time it takes a program to go from start to finish.

In UNIX - I can use the time command. Is there any way to do this in a MS DOS or FreeDOS?

1
  • 3
    No, there isn't.
    – harrymc
    Aug 12 at 20:12

3 Answers 3

4

There is not. But you can emulate something like with commands:

echo.|time
your_command
echo.|time

and calculate the difference between two times

One very sample C program like this can help you:

#include <stdio.h>
#include <time.h>
int main(int argc, char** argv)
{
time_t a, b;
a=time(NULL);
system(argv[1]);
b=time(NULL);
printf("%d\n", b-a);
}
14
  • Many Thanks. Is there perhaps a TSR 3rd party tool that can do this very accurately?
    – Coder
    Aug 12 at 20:27
  • @Coder, I am not aware of such tool Aug 12 at 20:31
  • Cygwin doesn't run in pure DOS.
    – Coder
    Aug 12 at 20:31
  • @Coder, correct. I realize it and remove my comment :) Aug 12 at 20:32
  • 1
    Thanks. I'm already writing a better version.
    – Coder
    Aug 12 at 21:00
1

Use 4DOS shell instead

4DOS is a command interpreter similar to Command, but contains extensions such as the ability to scroll back through previous commands, pop-up help, and other useful features. 4DOS was written by Rex Conn and Tom Rawson, both of JP Software.

http://wiki.freedos.org/wiki/index.php/4DOS

It's the most famous alternative shell that's vastly superior to COMMAND.COM and has a TIMER command for your purpose

The TIMER command lets you time events. The following line also shows 4DOS's ability to accept multiple commands on one line, separated by a caret [^]. It starts the timer, runs the TOUR2.BTM file to create the three demonstration files, deletes the three files, and then stops the timer and displays the time the whole operation took. Enter this command to time the entire sequence on your computer:

c:\4dos> timer ^ tour2 ^ del filel file2 file3 ^ timer
Timer 1 on: 11:10:01

Please wait ...

File creation completed
Deleting c:\4dos\file1
Deleting c:\4dos\file2
Deleting c:\4dos\file3
     3 file(s) deleted
Timer 1 off: 11:10:06 elapsed: 0:00:05.11

jpsoftware :: 4DOS Reference Manual
[page 37 - Chapter 3 / A guided tour of 4DOS # Other commands] — Text transcription for easy searching, but slightly incorrect due to OCR
(Alternative link)

In fact 4DOS is the predecessor of Take Command / TCC shell in Windows which also has the TIMER command

0

I found out that there is a program called RUNTIME.EXE on the FreeDOS 1.3 Bonus CD in the package RUNTIME.ZIP. This allows to measure the time it takes a program to run. It's quite similar to unix's time command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.