avatar
A question about command time# Unix - 噫吁兮,危乎高哉
T*B
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.
avatar
o*z
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.

avatar
T*B
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

avatar
o*z
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.

avatar
o*z
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.

avatar
T*B
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。