サーバーのよく使うコマンドメモ| time

2015年3月11日

コマンド サーバー テクノロジー

Summery

コマンドやスクリプトを実行する時にかかった時間を計測してくれる。 コマンドの前に「time」をつけるだけなので、非常に簡単。 ベンチマークなどを取る時に使うと便利。

Construction

$ time [command]

Option

man time : HELPを表示 -l : msecの計測 [default] -p : 0.0秒の計測 [response] real : プログラム実行から終了までの時間 user : ユーザープロセス時間 sys : OSが使用した時間

Sample

# 長時間かかるバッチ処理スクリプトなどを計測 $ time sh batch.sh # [結果] # real 10m1.004s # user 10m0.002s # sys 10m0.002s # どんなコマンドでも、実行->結果までにかかった時間を計測 $ time ls -la # [結果] # real 0m0.004s # user 0m0.002s # sys 0m0.002s

Discription

NAME time -- time command execution SYNOPSIS time [-lp] utility DESCRIPTION The time utility executes and times utility. After the utility finishes, time writes the total time elapsed, the time consumed by system overhead, and the time used to execute utility to the standard error stream. Times are reported in seconds. Available options: -l The contents of the rusage structure are printed. -p The output is formatted as specified by IEEE Std 1003.2-1992 (``POSIX.2''). Some shells may provide a builtin time command which is similar or iden- tical to this utility. Consult the builtin(1) manual page. DIAGNOSTICS The time utility shall exit with one of the following values: 1-125 An error occurred in the time utility. 126 The utility was found but could not be invoked. 127 The utility could not be found. Otherwise, the exit status of time shall be that of utility. SEE ALSO builtin(1), csh(1), getrusage(2) FILES /usr/include/sys/resource.h STANDARDS The time utility conforms to IEEE Std 1003.2-1992 (``POSIX.2''). BUGS The granularity of seconds on microprocessors is crude and can result in times being reported for CPU usage which are too large by a second.

このブログを検索

ごあいさつ

このWebサイトは、独自思考で我が道を行くユゲタの少し尖った思考のTechブログです。 毎日興味がどんどん切り替わるので、テーマはマルチになっています。 もしかしたらアイデアに困っている人の助けになるかもしれません。