/usr/bin/time – 간단하게 프로그램 실행 시간 알아보기

1. /usr/bin/time -v {command}
2. time {command}

Example : $ /usr/bin/time -v sleep 2
Example : $ time sleep 2

/usr/bin/time은 아래와 같이 프로그램 실행 시간을 포함해 다른 정보까지 자세히 알려준다.

~ root@dm1536803965686
❯ /usr/bin/time -v sleep 2
    Command being timed: "sleep 2"
    User time (seconds): 0.00
    System time (seconds): 0.00
    Percent of CPU this job got: 0%
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.00
    Average shared text size (kbytes): 0
    Average unshared data size (kbytes): 0
    Average stack size (kbytes): 0
    Average total size (kbytes): 0
    Maximum resident set size (kbytes): 1772
    Average resident set size (kbytes): 0
    Major (requiring I/O) page faults: 0
    Minor (reclaiming a frame) page faults: 73
    Voluntary context switches: 2
    Involuntary context switches: 1
    Swaps: 0
    File system inputs: 0
    File system outputs: 0
    Socket messages sent: 0
    Socket messages received: 0
    Signals delivered: 0
    Page size (bytes): 4096
    Exit status: 0

반면 time은 간단히 실행 시간만 알려준다.

~ root@dm1536803965686
❯ time sleep 2
sleep 2  0.00s user 0.00s system 0% cpu 2.007 total