作用
方法內部調用路徑,並輸出方法路徑上的每個節點上耗時。
介紹
trace
命令能主動搜索class-pattern
/method-pattern
對應的方法調用路徑,渲染和統計整個調用鏈路上的所有性能開銷和追蹤調用鏈路- 觀察表達式的構成主要由
ognl
表達式組成,所以你可以這樣寫"{params,returnObj}"
,只要是一個合法的ognl
表達式,都能被正常支持 - OGNL 表達式官網:https://commons.apache.org/proper/commons-ognl/language-guide.html
- 很多時候我們只想看到某個方法的
rt
大於某個時間之后的trace
結果,現在Arthas
可以按照方法執行的耗時來進行過濾了 - 例如
trace *StringUtils isBlank '#cost>100'
表示當執行時間超過100ms
的時候,才會輸出trace
的結果
trace demo.MathGame run
trace demo.MathGame run -n 2
trace --skipJDKMethod false demo.MathGame run -n 2
trace demo.MathGame run "#cost>0.5"