java - How can I calculate GC pause time? -


i need find way or calculate gc pause time time appears when use -xx:+printgcdetails:

[gc [psyounggen: 129536k->20978k(150528k)] 129536k->92722k(492544k), 0.1067600 secs] [times: user=0.18 sys=0.08, real=0.10 secs] [gc [psyounggen: 145214k->20987k(280064k)] 216958k->213054k(622080k), 0.1758780 secs] [times: user=0.36 sys=0.10, real=0.17 secs]  [gc [psyounggen: 280059k->20976k(280064k)] 472126k->412607k(674304k), 0.1969610 secs] [times: user=0.52 sys=0.11, real=0.20 secs]  [full gc [psyounggen: 20976k->5608k(280064k)] [paroldgen: 391631k->393789k(841728k)] 412607k->399398k(1121792k) [pspermgen: 4370k->4369k(21504k)], 2.0758810 secs] [times: user=6.38 sys=0.03, real=2.08 secs]  

i have tried use managementfactory.getgarbagecollectormxbeans() list , use getcollectiontime() method it's generate cumulative wall clock time scavenge gc , marksweep gc.

iterator beans = managementfactory.getgarbagecollectormxbeans().iterator();   while (beans.hasnext()) {       garbagecollectormxbean bean = (garbagecollectormxbean) beans.next();       system.out.println("name: " + bean.getname());       system.out.println("time: " + bean.getcollectiontime() + "ms");   }    

and result:

name: ps scavenge time: 487ms name: ps marksweep time: 3993ms name: ps scavenge time: 487ms name: ps marksweep time: 3993ms name: ps scavenge time: 487ms name: ps marksweep time: 3993ms name: ps scavenge time: 487ms name: ps marksweep time: 3993ms name: ps scavenge time: 487ms name: ps marksweep time: 3993ms name: ps scavenge time: 487ms name: ps marksweep time: 3993ms . . . name: ps marksweep time: 6233ms name: ps scavenge time: 5656ms name: ps marksweep time: 6233ms name: ps scavenge time: 5656ms name: ps marksweep time: 6233ms name: ps scavenge time: 5656ms name: ps marksweep time: 6233ms [gc [psyounggen: 1163264k->931840k(1242624k)] 2989743k-    >2990439k(3625984k), 2.4818040 secs] [times: user=19.02 sys=0.35, real=2.48 secs]  [full gc [psyounggen: 931840k->523250k(1242624k)] [paroldgen: 2058599k->2382949k(3540480k)] 2990439k->2906199k(4783104k) [pspermgen: 4338k->4338k(21504k)], 6.6675530 secs] [times: user=38.70 sys=0.14, real=6.67 secs]  name: ps scavenge time: 8137ms name: ps marksweep time: 12900ms name: ps scavenge time: 8137ms 

i know when gc start work it's cause stop-the-world need know pause times results gc before full gc stop world.

is there way catch ?

there hotspot-specific api provides gc notifications, including per-gc timing information: com.sun.management.garbagecollectionnotificationinfo

you'll have detect availability ensure compatibility other jvms.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -