關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • Linux – 查詢指令執行所需時間

    Posted on February 5th, 2006 Sam Tang No comments

    有時想查看執行某指令時所使用的時間,可以用 time 來實現,例如:

    time ls / > /dev/null

    以上是測試 “ls / > /dev/null” 的執行時間,實際上不加 > /dev/null 也沒有問題,只不過它真的會顯示 ls / 的結果而已。而以下是我的 Ubuntu laptop 執行以上指令得出的結果:

    real    0m0.011s   # 所需時間
    user    0m0.001s  # 在 user mode 使用的時間
    sys     0m0.003s  # 在 kernel mode 使用的時間


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word