Parse Java stdout (or .out log) and print GC frequency per minute.
Assumes following JVM flags are set
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -verbose:gc
#! /usr/bin/awk -f
# Awk script to parse Java .out log and print GC frequency per minute
#
# Assumes following JVM flags are set:
# -XX:+PrintGCDetails
# -XX:+PrintGCTimeStamps
# -verbose:gc
BEGIN {print "t,count"}
/\[GC:/
{
split($7, a, ":");
t=a[1]":"a[2];
freq[t]++ ;
if (start[1] == null)
{
start[1] = a[1];
start[2] = a[2];
}
end[1] = a[1];
end[2] = a[2];
}
END
{
for (hour = start[1]; hour <= end[1]; hour++)
{
for (minute = 0; minute <= 59; minute++)
{
t = sprintf("%02d:%02d", hour, minute);
if (freq[t] == null)
{
printf "%s,%d\n", t, 0;
}
else
{
printf "%s,%d\n", t, freq[t];
}
}
}
}
Assumes following JVM flags are set
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -verbose:gc
#! /usr/bin/awk -f
# Awk script to parse Java .out log and print GC frequency per minute
#
# Assumes following JVM flags are set:
# -XX:+PrintGCDetails
# -XX:+PrintGCTimeStamps
# -verbose:gc
BEGIN {print "t,count"}
/\[GC:/
{
split($7, a, ":");
t=a[1]":"a[2];
freq[t]++ ;
if (start[1] == null)
{
start[1] = a[1];
start[2] = a[2];
}
end[1] = a[1];
end[2] = a[2];
}
END
{
for (hour = start[1]; hour <= end[1]; hour++)
{
for (minute = 0; minute <= 59; minute++)
{
t = sprintf("%02d:%02d", hour, minute);
if (freq[t] == null)
{
printf "%s,%d\n", t, 0;
}
else
{
printf "%s,%d\n", t, freq[t];
}
}
}
}
No comments:
Post a Comment