WinDbg:如何在断点中包含线程id和时间值。printf_而不使用伪寄存器?

WinDbg:如何在断点中包含线程id和时间值。printf_而不使用伪寄存器?,windbg,Windbg,我有一些断点“对”,我想测量它们被命中的间隔时间 允许我这样做的最简单的事情是在我遇到断点时使用的.printf中包含某种时间戳(即使它只是时钟信号或其他东西) 我可以在断点代码中使用$tid和$dbgtime。当我这么做的时候,表演真的很糟糕 bp1000 ucrtbase!malloc ".printf \"[0x%08x] [ucrtbase] [0x%04x] [0x%08x] malloc(%d): \", $dbgtime, $tid, dwo(@esp), dwo(@esp+4);

我有一些断点“对”,我想测量它们被命中的间隔时间

允许我这样做的最简单的事情是在我遇到断点时使用的
.printf
中包含某种时间戳(即使它只是时钟信号或其他东西)

我可以在断点代码中使用
$tid
$dbgtime
。当我这么做的时候,表演真的很糟糕

bp1000 ucrtbase!malloc ".printf \"[0x%08x] [ucrtbase] [0x%04x] [0x%08x] malloc(%d): \", $dbgtime, $tid, dwo(@esp), dwo(@esp+4); gc "
当使用相同的代码时(没有为时间戳和线程id使用有意义的值),情况会好得多

是否有其他(高性能)方法获取此信息?当前时间比线程ID更有价值。我始终可以使断点仅应用于特定线程,以便只发送ID。

试试这个

0:000> bp ucrtbase!malloc "~# ; .echotime ; dd @$csp l2 ; gc ;"
0:000> bl
 0 e 00007ff8`ab61c9e0     0001 (0001)  0:**** ucrtbase!malloc "~# ; .echotime ; dd @$csp l2 ; gc ;"
0:000> g
.  0  Id: 1a84.1f14 Suspend: 1 Teb: 00000018`f49d1000 Unfrozen
      Start: cdb!wmainCRTStartup (00007ff6`efd2bbf0)
      Priority: 0  Priority class: 32  Affinity: f
Debugger (not debuggee) time: Wed Aug  7 22:17:44.992 2019 
00000018`f47eeb58  ab622762 00007ff8
.  0  Id: 1a84.1f14 Suspend: 1 Teb: 00000018`f49d1000 Unfrozen
      Start: cdb!wmainCRTStartup (00007ff6`efd2bbf0)
      Priority: 0  Priority class: 32  Affinity: f
Debugger (not debuggee) time: Wed Aug  7 22:17:44.992 2019 (UTC + 5:30)
00000018`f47eeb08  ab622762 00007ff8
试试这个

0:000> bp ucrtbase!malloc "~# ; .echotime ; dd @$csp l2 ; gc ;"
0:000> bl
 0 e 00007ff8`ab61c9e0     0001 (0001)  0:**** ucrtbase!malloc "~# ; .echotime ; dd @$csp l2 ; gc ;"
0:000> g
.  0  Id: 1a84.1f14 Suspend: 1 Teb: 00000018`f49d1000 Unfrozen
      Start: cdb!wmainCRTStartup (00007ff6`efd2bbf0)
      Priority: 0  Priority class: 32  Affinity: f
Debugger (not debuggee) time: Wed Aug  7 22:17:44.992 2019 
00000018`f47eeb58  ab622762 00007ff8
.  0  Id: 1a84.1f14 Suspend: 1 Teb: 00000018`f49d1000 Unfrozen
      Start: cdb!wmainCRTStartup (00007ff6`efd2bbf0)
      Priority: 0  Priority class: 32  Affinity: f
Debugger (not debuggee) time: Wed Aug  7 22:17:44.992 2019 (UTC + 5:30)
00000018`f47eeb08  ab622762 00007ff8