BACKRUSH  대화방입장  유닉스명령  다음  자료실  Ascii Table   Exploit   원격접속  달력,시간   프로세스  
지하철노선   Whois   RFC문서   SUN FAQ   SUN FAQ1   C메뉴얼   PHP메뉴얼   너구리   아스키월드 아이피서치

글쓴이: proc Processverbosegc.awk 내용 gc분석 조회수: 7420



#!/bin/awk
# processVerboseGC for JDK 1.2.2.05 for use with -Xverbosegc
# 000817 coha
#
# Suggested use:
# Just look at the memory use pattern:
# java -Xverbosegc mymemtest 2>&1 | awk -f processVerboseGC
#
# Save the output for later analysis, but look at what's going on:
# java -verbosegc -mx24m mymemtest 2> glog &
# tail -f glog | awk -f processVerboseGC
#
# Tracks memory usage in each of the Java Heap's 3 spaces
# Spaces: new old permanent
# Sub-spaces: eden from to
#
# First GC:
# Objects are created in eden and the live ones migrate into "to" (survivor)
# and "to" is renamed "from"
# Subsequent GCs:
# Live objects in the "from" and eden spaces are copied to the "to"
# space and the "to" space is renamed "from"
# Eventually:
# Objects in the "from" space are tenured to the old space
#
# Scavenge GCs are done in the new space
# Full GCs occur as mark and sweep in new and old
#
# -----------------------------------------------------------------
#
# -Xverbosegc<options> (1.2.2.05 and later)
# ========================================
#
# Prints out detailed information about the spaces within the
# Java Heap before and after garbage collection. The syntax of
# the option is:
#
# -Xverbosegc[:help]|[0|1][:file=[stdout|stderr|<filename>]]
#
# :help prints this message.
#
# 0|1 controls the printing of heap information:
# 0 Only after each full GC
# 1 (default) After every Scavenge and Full GC
#
# :file=[stdout|stderr|<filename>] specifies output file
# stderr (default) directs output to standard error stream
# stdout directs output to standard output stream
# <filename> file to which the output will be written
#
# At every garbage collection, the following 18 fields are printed:
# <GC: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18 >
#
# %1: Indicates the cause of the garbage collection.
# -1: indicates a Scavenge (GC of New Generation only)
# 0-6: indicates a Full GC (collection of all spaces in the
# Java Heap)
# Reason:
# 0: Call to System.gc
# 1: Old Generation full
# 2: Permanent Generation full
# 3: Train Generation full
# 4: Old generation expanded on last scavenge
# 5: Old generation too full to scavenge
# 6: FullGCAlot
#
# %2: Program time at the beginning of the collection, in seconds
#
# %3: Garbage collection invocation. Counts of Scavenge and
# Full GCs are maintained separately
#
# %4: Size of the object allocation request that forced the GC,
# in bytes
#
# %5: Tenuring threshold - determines how long the new born object
# remains in the New Generation
#
# The report includes the size of each space:
# Occupied before garbage collection (Before)
# Occupied after garbage collection (After)
# Current capacity (Capacity)
# All values are in bytes
#
# Eden Sub-space (within the New Generation)
# %6: Before
# %7: After
# %8: Capacity
#
# Survivor Sub-space (within the New Generation)
# %9: Before
# %10: After
# %11: Capacity
#
# Old Generation
# %12: Before
# %13: After
# %14: Capacity
#
# Permanent Generation (Storage of Reflective Objects)
# %15: Before
# %16: After
# %17: Capacity
#
# %18: Time required to complete collection, in seconds
#
# %19: Parameter present if deferred collection (!defer!)
#
# -----------------------------------------------------------------
#
# Suggestion: USE WIDE LINES AND A SMALL FONT WITH SCRIPT
#
# awk field number
# ----------------
# 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# <GC: 4 1.985317 1 88 2 1834928 0 3670016 120576 0 262144 3204992 2356088 3928064 773552 773552 1048576 0.096908 >
# <GC: -1 2.190710 29 72 32 3669968 0 3670016 0 120720 262144 2356088 2356088 3928064 773552 773552 1048576 0.004437 >

BEGIN {
float last;
last = 0;
}

{
if ( $1 == "<GC:" ) {
char fors;
char defer;
char reason;
int intreason;
if (int($2) == -1) {
fors="Scav";
} else {
fors="Full";
intreason=(int($2));
if (intreason == 0) {
reason="Call to System.gc";
}
else if (intreason == 1) {
reason="Old Generation full";
}
else if (intreason == 2) {
reason="Permanent Generation full";
}
else if (intreason == 3) {
reason="Train Generation full";
}
else if (intreason == 4) {
reason="Old generation expanded on last scavenge";
}
else if (intreason == 5) {
reason="Old generation too full to scavenge";
}
else if (intreason == 6) {
reason="FullGCAlot";
}
else {
reason="unknown";
}
printf("GC: %s GC required - reason: %s\n",
fors, reason);
}
if ($20 == "!defer!>") defer="defer"; else defer="";
printf("GC: %s %f s since last: %f s gc time: %d ms size: %d bytes \teden: %d->%d/%d\tsurvivor: %d->%d/%d\t tenure: %d\told: %d->%d/%d\tperm: %d->%d/%d\t%s\n",
fors,$3, ($3-last), ($19*1000.0), $5, $7,$8,$9, $10,$11,$12, $6, $13,$14,$15, $16,$17,$18, defer);
last=$3;
}
else {
print $0;
}
}


관련글 : 없음 글쓴시간 : 2006/10/19 17:20 from 218.38.35.251

  [응답]GC 내용분석 목록보기 새글 쓰기 지우기 응답글 쓰기 글 수정 weblogic jdbc 디버그  
BACKRUSH  대화방입장  유닉스명령  다음  자료실  Ascii Table   Exploit   원격접속  달력,시간   프로세스  
지하철노선   Whois   RFC문서   SUN FAQ   SUN FAQ1   C메뉴얼   PHP메뉴얼   너구리   아스키월드 아이피서치