2017-06-13 35 views
2

在Linux上測試我的jar應用程序時,我使用下面的命令行來跟蹤特定對象(例如JButton)的使用情況/內存負載。在Windows上使用特定對象時的jmap -histo

jmap -histo:live <pid> | grep JButton 

導致:

35:   24   11136 javax.swing.JButton 
99:   31   2728 javax.swing.JButton$AccessibleJButton 

現在我想要做與Windows相同的,但我不能找到一個類似的命令(如grep)來跟蹤特定對象。 jmap -histo[:live] <pid>提供了所有對象的完整列表。 Windows是否有類似的工具用於這種用法或替代方式?

+3

https://superuser.com/questions/300815/grep-equivalent-for-windows-7 – Eugene

+3

你可以使用['find'JButton「'](https://technet.microsoft.com/en-us /library/bb490906.aspx)。請注意,引號是必需的。 – Holger

+0

@Holger我剛測試過它,工作得很好。非常感謝你。 – Zerthimon

回答

3

我測試的意見建議,我們現在有一個答案:

jmap -histo:live <pid> | grep JButton 

Linux的等同於:

jmap -histo:live <pid> | find "JButton" 

jmap -histo:live <pid> | findstr JButton 

的Windows

+2

你可以在幾天內接受你自己的答案 – Eugene

相關問題