0

Normally I don't post questions which are trying to get advice on how to directly a question in a textbook but in this case I feel it is necessary.

The last questions said to write a C program and then set it up as a cron job. I've done that.

The next question asks (so I assume it's possible):

Explain how you can find the time it took the computer to execute your program.

Half the time I'm not sure if the program even executed at all so I'm glad to hear there may be a method to not only check that but how long it took to execute.

How can I find the time taken to execute the program?

  • 1
    use the time command – Ijaz Ahmad Khan Feb 16 '17 at 22:25
  • @Ijax Would I add that to the cron job command? – Philip Kirkbride Feb 16 '17 at 22:26
  • 2
    yes , time the command and redirect the timing info to some file on disk – Ijaz Ahmad Khan Feb 16 '17 at 22:29
2

It sounds like it's asking for the time it took to execute your C program, not how long cron took to execute it. However, as others have commented, you can use the time program to time a command's execution, as below:

$ time myprogram will give you the total time the program took to execute to completion.

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.