Measuring time spent on GC in JVM(在 JVM 中测量花费在 GC 上的时间)
问题描述
假设我正在测试一个 Java 服务器应用程序.我知道完成考试需要多少时间.现在我想知道在那次测试期间在 GC 上花了多少钱.我该怎么做?
Suppose I am testing a Java server application. I know how much time it takes to finish the test. Now I'd like to know how much was spent on GC during that test. How can I do it?
推荐答案
最简单的方法是启动时使用-Xloggc和-XX:-PrintGCTimeStamps选项你的JVM.我认为它会打印出垃圾收集需要多长时间.
The simplest way is to use the -Xloggc and -XX:-PrintGCTimeStamps options when starting up your JVM. I think it prints out how long garbage collection takes.
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
这篇关于在 JVM 中测量花费在 GC 上的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 JVM 中测量花费在 GC 上的时间
基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
