I need to measure a process execution time in my own shell program.
Currently, I am research on the "time" command provides by unix system.
At the terminal, I typed the command "time ls", where "ls" is the process i want to execute and measure for it run time.
The command execute as below:
$time ls
real 0m0.007s
user 0m0.000s
system 0m0.000s
This result is send to the standard output and print on screen. However, I need it to be store in a file instead.
I tried the command "time ls >> abc.txt", but it store the execution result of "ls" instead of "time ls" into the file.
I tried "time -o abc.txt ls" but the system say -o command not found.
Anyone who know how to direct the "time" result" to a file instead on printing on the screen? Or are there a better way to record the execution time for a process?
Please advise me! Thanks in advance ^^