# Present text graphics display of verbose-GC output. # Verbosegc is obtained by providing the -verbose:gc # to the JVM command line options. The output is found # in the JVM's stderr. # # The verbosegc output differes somewhat from one version # of the JVM to the next. That's why each version of this # script is unique to a particular version of a JVM (not # just a particular vendor. # # This version works with the IBM JDK 1.3.0 with the following # -fullversion output: # "J2RE 1.3.0 IBM build cn130-20010925was" # # Paul Glezen my @slices = (); my $sliceId = ""; my $currentSec = 0; my $month, $day, $hour, $min, $sec; my $key; my $lastAF = 0; while (<>) { # How long since last GC. # if (/^ $month, "day" => $day, "hour" => $hour, "min" => $min, "sec" => $sec, "lastAF" => $lastAF, "gcTime" => 0 }; $lastAF = 0; push(@slices, $slice); } } # If we're adding time from a current GC record # if (/^$/) { $$slice{"gcTime"} += $1; } } close LOG; my $rowCount = 0; my $showHeaderAgain = 40; print "\n%GC\n"; foreach $slice (@slices) { # Show the header every so often. # if ( ! ($rowCount % $showHeaderAgain)) { print " 0% 10% 20% 30% 30% 50%\n"; print " |---------|---------|---------|---------|---------|\n"; } $rowCount++; # The magic number 20 = 1000 msec / 50 tic marks. # my $tics = $$slice{"gcTime"} / 20; my $tics = 100 * $$slice{gcTime} / ($$slice{gcTime} + $$slice{lastAF}); my $bar = "*" x $tics; print "[$$slice{\"month\"} $$slice{\"day\"} "; print "$$slice{\"hour\"}:$$slice{\"min\"}:$$slice{\"sec\"}] $bar\n"; }