T***B 发帖数: 137 | 1 I need to track the time run for a program and save the data to a file. I
tried the following command:
time ./a.out > output
0.000u 0.010s 0:00.01 100.0% 0+0k 0+0io 132pf+0w
But the data about timing was still printed on the screen, not to the file.
Can anyone help? Thanks.
BTW, I run the command under linux. |
o***z 发帖数: 133 | 2 -o option?
man time
【在 T***B 的大作中提到】 : I need to track the time run for a program and save the data to a file. I : tried the following command: : time ./a.out > output : 0.000u 0.010s 0:00.01 100.0% 0+0k 0+0io 132pf+0w : But the data about timing was still printed on the screen, not to the file. : Can anyone help? Thanks. : BTW, I run the command under linux.
|
T***B 发帖数: 137 | 3 Thanks, ottoz.
There is a -o option in the man time file. But it doesn't work in my
environment (bad command). It seems that -o is a GNU option. Is this the cause
of the problem? Is that a way to handle it?
GNU OPTIONS
-f FORMAT, --format=FORMAT
Specify output format, possibly overriding the for-
mat specified in the environment variable TIME.
-p, --portability
Use the portable output format.
-o FILE, --output=FILE
Do
【在 o***z 的大作中提到】 : -o option? : man time
|
o***z 发帖数: 133 | 4 what's your shell
and what did you type as the command?
【在 T***B 的大作中提到】 : Thanks, ottoz. : There is a -o option in the man time file. But it doesn't work in my : environment (bad command). It seems that -o is a GNU option. Is this the cause : of the problem? Is that a way to handle it? : GNU OPTIONS : -f FORMAT, --format=FORMAT : Specify output format, possibly overriding the for- : mat specified in the environment variable TIME. : -p, --portability : Use the portable output format.
|
o***z 发帖数: 133 | 5 there's a built-in time command in tcsh
did you try
/usr/bin/time -V
【在 T***B 的大作中提到】 : Thanks, ottoz. : There is a -o option in the man time file. But it doesn't work in my : environment (bad command). It seems that -o is a GNU option. Is this the cause : of the problem? Is that a way to handle it? : GNU OPTIONS : -f FORMAT, --format=FORMAT : Specify output format, possibly overriding the for- : mat specified in the environment variable TIME. : -p, --portability : Use the portable output format.
|
T***B 发帖数: 137 | 6 Thanks. My shell is tcsh.
And the following command works:
/usr/bin/time -o tracktime ./a.out > output
cause
【在 o***z 的大作中提到】 : there's a built-in time command in tcsh : did you try : /usr/bin/time -V
|