成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

Java讀取GC的耗時(shí)和次數(shù)

Leo_chen / 1116人閱讀

代碼
    public static void main(String[] args) {
        for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
            long count = gc.getCollectionCount();
            long time = gc.getCollectionTime();
            String name = gc.getName();
            System.out.println(String.format("%s: %s times %s ms", name, count, time));
        }
    }
結(jié)果

一個(gè)young generation collector和一個(gè)old generation collector

PS Scavenge: 0 times 0 ms
PS MarkSweep: 0 times 0 ms
Young generation collectors
Copy (enabled with -XX:+UseSerialGC)

the serial copy collector, uses one thread to copy surviving objects from Eden to Survivor spaces and between Survivor spaces until it decides they"ve been there long enough, at which point it copies them into the old generation.

PS Scavenge (enabled with -XX:+UseParallelGC)

the parallel scavenge collector, like the Copy collector, but uses multiple threads in parallel and has some knowledge of how the old generation is collected (essentially written to work with the serial and PS old gen collectors).

ParNew (enabled with -XX:+UseParNewGC)

the parallel copy collector, like the Copy collector, but uses multiple threads in parallel and has an internal "callback" that allows an old generation collector to operate on the objects it collects (really written to work with the concurrent collector).

G1 Young Generation (enabled with -XX:+UseG1GC)

the garbage first collector, uses the "Garbage First" algorithm which splits up the heap into lots of smaller spaces, but these are still separated into Eden and Survivor spaces in the young generation for G1.

Old generation collectors
MarkSweepCompact (enabled with -XX:+UseSerialGC)

the serial mark-sweep collector, the daddy of them all, uses a serial (one thread) full mark-sweep garbage collection algorithm, with optional compaction.

PS MarkSweep (enabled with -XX:+UseParallelOldGC)

the parallel scavenge mark-sweep collector, parallelised version (i.e. uses multiple threads) of the MarkSweepCompact.

ConcurrentMarkSweep (enabled with -XX:+UseConcMarkSweepGC)

the concurrent collector, a garbage collection algorithm that attempts to do most of the garbage collection work in the background without stopping application threads while it works (there are still phases where it has to stop application threads, but these phases are attempted to be kept to a minimum). Note if the concurrent collector fails to keep up with the garbage, it fails over to the serial MarkSweepCompact collector for (just) the next GC.

G1 Mixed Generation (enabled with -XX:+UseG1GC)

the garbage first collector, uses the "Garbage First" algorithm which splits up the heap into lots of smaller spaces.

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/76336.html

相關(guān)文章

  • [譯]GC專家系列2:Java 垃圾回收監(jiān)控

    摘要:原文鏈接這是專家系列文章的第二篇。運(yùn)行在本地虛擬機(jī)上的應(yīng)用的又稱為,通常與相同。性能數(shù)據(jù)需要持續(xù)觀察,因此在運(yùn)行時(shí)需要定時(shí)輸出的監(jiān)控信息。新生代容量的統(tǒng)計(jì)信息。是提供的一個(gè)式的圖表監(jiān)控工具。 原文鏈接:http://www.cubrid.org/blog/dev-platform/how-to-monitor-java-garbage-collection/ 這是GC專家系列文章的第二...

    yiliang 評(píng)論0 收藏0
  • [譯]GC專家系列3-GC調(diào)優(yōu)

    摘要:原文鏈接本篇是專家系列的第三篇。但是,請(qǐng)記住調(diào)優(yōu)是不得已時(shí)的選擇。縮短耗時(shí)的單次執(zhí)行與相比,耗時(shí)有較明顯的增加。創(chuàng)建文件過程中,進(jìn)程會(huì)中斷,因此不要在正常運(yùn)行時(shí)系統(tǒng)上做此操作。因此校驗(yàn)結(jié)果并根據(jù)具體的服務(wù)需要,決定是否要進(jìn)行調(diào)優(yōu)。 原文鏈接:http://www.cubrid.org/blog/dev-platform/how-to-tune-java-garbage-collecti...

    leap_frog 評(píng)論0 收藏0
  • 江義旺:滴滴出行安卓端 finalize time out 解決方案

    摘要:此前滴滴出行安卓端曾長(zhǎng)期受此的影響,每天有一些用戶會(huì)因此遇到,經(jīng)過深度分析,最終找到有效解決方案。方法內(nèi)盡量減少耗時(shí)以及線程同步時(shí)間。減少高優(yōu)先級(jí)線程的創(chuàng)建和使用,降低高優(yōu)先級(jí)線程的使用率。出品 | 滴滴技術(shù)作者 | 江義旺showImg(https://user-gold-cdn.xitu.io/2019/5/15/16ab95686cf247c1);前言:隨著安卓 APP 規(guī)模越來越大,...

    Betta 評(píng)論0 收藏0
  • 《深入理解Java虛擬機(jī)》(四)虛擬機(jī)性能監(jiān)控與故障處理工具

    摘要:虛擬機(jī)性能監(jiān)控與故障處理工具詳解概述本文參考的是周志明的深入理解虛擬機(jī)第四章,為了整理思路,簡(jiǎn)單記錄一下,方便后期查閱。虛擬機(jī)堆轉(zhuǎn)儲(chǔ)快照分析工具功能用于分析生成的。 虛擬機(jī)性能監(jiān)控與故障處理工具 詳解 4.1 概述 本文參考的是周志明的 《深入理解Java虛擬機(jī)》 第四章 ,為了整理思路,簡(jiǎn)單記錄一下,方便后期查閱。 JDK本身提供了很多方便的JVM性能調(diào)優(yōu)監(jiān)控工具,除了集成式的Vis...

    gself 評(píng)論0 收藏0
  • 逐夢(mèng)offer -- JVM篇

    摘要:的字節(jié)碼解釋器和編譯器使用寫屏障維護(hù)卡表。解釋器每次執(zhí)行更新引用的字節(jié)碼時(shí),都會(huì)執(zhí)行一段寫屏障,編譯器在生成更新引用的代碼后,也會(huì)生成一段寫屏障。 4. JVM 4.1 GC 1. 垃圾收集 基礎(chǔ) : 可達(dá)性分析算法 GC ROOTS 復(fù)制算法 標(biāo)記清除 標(biāo)記整理 分代收集 -- 1. 新生代 ; 2.3 老年代注: Oop Map -- 安全點(diǎn) -- 安全區(qū) 以下部分內(nèi)容 來自 ...

    greatwhole 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<