-2

We are looking for a way on a Mac to measure the time in milliseconds from after a shell script issues a command until that command actually begins execution on the cpu. This time would represent the time to fork, exec the command, run the exec syscall, page in the first page or so of the process and start it running.

5
  • What have you tried? Did you look at the time command?
    – Allan
    Apr 6 '20 at 2:19
  • Hi @Allan we are at a loss. The time command gives real user and sys times, but how much of those was before the program began execution on the CPU? Apr 6 '20 at 2:25
  • See this link: apple.stackexchange.com/a/378996/119271 - it might get you started, but might also be not enough.
    – Allan
    Apr 6 '20 at 2:36
  • Can you determine that by running something like time ps where assuming ps starts immediately? Or some other command to calibrate the time command?
    – Natsfan
    Apr 6 '20 at 2:37
  • Ouch for the -1 for a person starting out. Please help me create a better question. May 11 '20 at 22:29
-2

You can use the time command. Try: time shell_script on the command line. You can run time ls to get time of ls command. For more on time enter man time on the command line.

5
  • 1
    “Try: time shell_script on the command line.” What does this mean? “ You can run time ls to get time of ls command.”. What “time” are you going to get back and how does it relate to the OP’s question?
    – Allan
    Apr 6 '20 at 6:26
  • it means if his shell-script is named fubar, then he can get the time by running 'time fubar' from the commnd line.
    – Natsfan
    Apr 6 '20 at 15:12
  • i answered the question at same time as your comment. So i left my answer as is.
    – Natsfan
    Apr 6 '20 at 15:13
  • I'm not worried about that...I'm just having a hard time understanding your answer.
    – Allan
    Apr 6 '20 at 15:15
  • it is worded poorly i admit. i was trying to give an example with ls. I should have taken more time but the answer was a valid answer. Use the time command to find out time period of a shell script.
    – Natsfan
    Apr 6 '20 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .