10

I'm trying to measure the execution time of a C program I wrote. However, I want to see a detailed output of different times, percent of CPU use, etc. I try

time -v ./a.out

But I get an error that states the command -v was not found. However, I have checked the man pages for time and -v or --verbose is an option.

What's wrong?

muru
  • 193,181
  • 53
  • 473
  • 722
Areg Sarvazyan
  • 103
  • 1
  • 8
  • Maybe the command `valgrind` also could be interesting for you. Here is example of usage: https://askubuntu.com/a/960644/566421 – pa4080 Mar 27 '18 at 17:50

1 Answers1

15

That means the time that you are using is the bash shell built in time which the only option is -p and you cannot even use -V, instead use the actual command with specifying its full path:

/usr/bin/time -v ./a.out

the man page is for the above command that if you do which time, will see /usr/bin/time. For the bash built-in time, you can help time.

Further reading:

αғsнιη
  • 35,092
  • 41
  • 129
  • 192