Domanda

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.

È stato utile?

Soluzione 2

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

Useless use of cat

Altri suggerimenti

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

time sh -c "cmd | cmd"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top