3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GNU timeを知った

Posted at

High Performance Python 2nd Editionを読む中で、
timeはGNU版と簡易版の二つがあることを知った。

time(シェル組み込み)

bashやzshのプロンプトでパスが通っている timeはシェル組み込みのtimeで、簡易版らしい。

# zsh
$ time sleep 1
sleep 1  0.00s user 0.00s system 0% cpu 1.004 total

GNU time

/usr/bin/timeにインストールされたコマンドはGNU版で、上記よりもリッチな情報を出すことができる。

macの場合はbrew install gnu-timegtimeとしてインストール可能。

$ gtime --verbose sleep 1
        Command being timed: "sleep 1"
        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:01.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): 612
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 297
        Voluntary context switches: 0
        Involuntary context switches: 17
        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

Major (requiring I/O) page faultsは、スワップの発生を意味しており注意すべきメトリクスである。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?