国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Java讀取GC的耗時和次數

Leo_chen / 1101人閱讀

代碼
    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));
        }
    }
結果

一個young generation collector和一個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.

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/76336.html

相關文章

  • [譯]GC專家系列2:Java 垃圾回收監控

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

    yiliang 評論0 收藏0
  • [譯]GC專家系列3-GC調優

    摘要:原文鏈接本篇是專家系列的第三篇。但是,請記住調優是不得已時的選擇。縮短耗時的單次執行與相比,耗時有較明顯的增加。創建文件過程中,進程會中斷,因此不要在正常運行時系統上做此操作。因此校驗結果并根據具體的服務需要,決定是否要進行調優。 原文鏈接:http://www.cubrid.org/blog/dev-platform/how-to-tune-java-garbage-collecti...

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

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

    Betta 評論0 收藏0
  • 《深入理解Java虛擬機》(四)虛擬機性能監控與故障處理工具

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

    gself 評論0 收藏0
  • 逐夢offer -- JVM篇

    摘要:的字節碼解釋器和編譯器使用寫屏障維護卡表。解釋器每次執行更新引用的字節碼時,都會執行一段寫屏障,編譯器在生成更新引用的代碼后,也會生成一段寫屏障。 4. JVM 4.1 GC 1. 垃圾收集 基礎 : 可達性分析算法 GC ROOTS 復制算法 標記清除 標記整理 分代收集 -- 1. 新生代 ; 2.3 老年代注: Oop Map -- 安全點 -- 安全區 以下部分內容 來自 ...

    greatwhole 評論0 收藏0

發表評論

0條評論

Leo_chen

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<