Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Linux top 命令 TIME/TIME+ 欄位含義深度解讀

編輯:Linux 系統常見問題解答

核心結論

TIME / TIME+ 顯示的是進程佔用的 CPU 時間總和,而非進程運行的牆鐘時間 (壁鐘時間/實際經過時間)。

詳細含義

欄位含義精度顯示格式示例
TIME進程啟動以來佔用的總 CPU 時間 (用戶態 + 內核態)秒2:32 = 2 分 32 秒
TIME+同 TIME,但顯示百分之一秒精度0.01 秒2:32.45 = 2 分 32.45 秒

關鍵特性

  1. 累加多核 CPU 時間:多線程進程在多核上並行運行時,各線程 CPU 時間累加。4 線程滿載 1 秒 → TIME 增加 ~4 秒。
  2. 不包含睡眠/等待時間:進程睡眠、等待 I/O、等待調度期間不計入。
  3. 累積模式 (S 鍵切換):按 S 切換 Cumulative mode,顯示進程及其已結束子進程的 CPU 時間總和。

格式解讀

TIME+  2:32.45
       │ │  └─ 百分之一秒 (45)
       │ └──── 秒 (32)
       └────── 分 (2)

即 2 分鐘 32 秒 450 毫秒。

實戰判斷技巧

現象可能原因排查方向
進程運行數天但 TIME 極小進程長期睡眠/空閒 (守護進程、定時任務間隔大)正常,無需處理
TIME 快速增長接近 CPU 核心數 × 時間計算密集型任務、死循環、無效自旋鎖perf top / gdb 分析熱點函數
多線程進程 TIME 遠超運行時間多核並行計算 (正常) 或線程過多上下文切換開銷檢查線程池大小、鎖競爭

手冊原文參考

TIME — CPU Time
Total CPU time the task has used since it started. When Cumulative mode is On, each process is listed with the cpu time that it and its dead children has used.

TIME+ — CPU Time, hundredths
The same as TIME, but reflecting more granularity through hundredths of a second.
Copyright © Windows教程網 All Rights Reserved