Windbg常用命令系列---顯示線程時間(.ttime)


.ttime (Display Thread Times)

ttime命令顯示線程的創建時間,以及它在內核模式和用戶模式下運行的時間。

.ttime 

環境

Modes

user mode only

Targets

live, crash dump

Platforms

x86 only

說明

此命令僅在用戶模式下工作。在內核模式下你應該使用!thread。只要使用/mt或/ma選項創建用戶模式的小型轉儲,此命令就可以使用;

0:000:x86> .ttime
Created: Thu Apr  9 09:36:08.130 2020 (UTC + 8:00)
Kernel:  0 days 0:01:05.875
User:    0 days 0:01:09.859

.ttime 可以查看當前線程的運行時間(用戶態運行時間和內核態運行時間)。但是 .ttime 有個不足之處——沒有輸出相關的線程標識。我們需要根據其它信息來獲取當前線程的標識。

如果想查看所有線程的運行時間怎么辦呢?當然可以手動切換到另外一個線程,然后執行 .ttime 。如果線程數量很多的話,這可是個體力活。不要怕,我們可以通過命令 ~*e .ttime 來獲取每個線程的運行時間。因為 .ttime 輸出結果中沒有線程標識,我們需要執行命令 ~*e ? $tid;.ttime 把對應的 線程ID 一起輸出。

0:000:x86> ~*e ? $tid;.ttime 
Evaluate expression: 16904 = 00004208
Created: Thu Apr  9 09:36:08.130 2020 (UTC + 8:00)
Kernel:  0 days 0:01:05.875
User:    0 days 0:01:09.859
Evaluate expression: 9256 = 00002428
Created: Thu Apr  9 09:36:08.461 2020 (UTC + 8:00)
Kernel:  0 days 0:00:00.000
User:    0 days 0:00:00.000
Evaluate expression: 6268 = 0000187c
Created: Thu Apr  9 09:36:08.462 2020 (UTC + 8:00)
Kernel:  0 days 0:00:00.000
User:    0 days 0:00:00.000
Evaluate expression: 11704 = 00002db8
Created: Thu Apr  9 09:36:08.469 2020 (UTC + 8:00)
Kernel:  0 days 0:00:00.000
User:    0 days 0:00:00.000
Evaluate expression: 9196 = 000023ec
Created: Thu Apr  9 09:36:08.506 2020 (UTC + 8:00)
Kernel:  0 days 0:00:00.000
User:    0 days 0:00:00.000
Evaluate expression: 15868 = 00003dfc
Created: Thu Apr  9 09:36:08.506 2020 (UTC + 8:00)
Kernel:  0 days 0:00:00.015
User:    0 days 0:00:00.000


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM