문제

I need to use the GNU time command to measure a program I've written, so I tried

/usr/bin/time -v cat test/testin | ./db retrieve >> test/result

But the first line in the output showed

Command being timed: "cat test/testin"

and the user time and system time were

User time (seconds): 0.00
System time (seconds): 0.02
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 2:02.73

which showed it didn't count the time used by my program since this program should've run 2 minutes or longer with considerable CPU usage.

도움이 되었습니까?

해결책 2

/usr/bin/time -v ./db retrieve < test/testin >> test/result

Useless use of cat

다른 팁

In your case, you can simply omit the UUOC. In the general case, you can do

time sh -c "cmd | cmd"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top