61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/jvm_gclog.rb', line 61
def parse(data)
if data.class == String
data = [data]
end
record = {}
m = @regexp_prefix.match(data[0])
body = $'
unless m
record["type"] = "Unknown"
record["unknown"] = data.join(" ")
return record
end
record["time"] = Time.parse(m[:time]).to_i
record["uptime"] = adjust_type(m["uptime"])
case body
when /^\[GC pause/
line = data.join(" ")
fields = [
/\[GC Worker Total \(ms\): (?<gctime_total>\d+\.\d+)/,
/\[Eden: (?<eden_before>\d+\.\d+.)\((?<eden_total_before>\d+\.\d+.)\)->(?<eden_after>\d+\.\d+.)\((?<eden_total_after>\d+\.\d+.)\) Survivors: (?<survivors_before>\d+\.\d+.)->(?<survivors_after>\d+\.\d+.) Heap: (?<heap_before>\d+\.\d+.)\((?<heap_total_before>\d+\.\d+.)\)->(?<heap_after>\d+\.\d+.)\((?<heap_total_after>\d+\.\d+.)\)\]/,
/\[Times: user=(?<gctime_user>[\d\.]+) sys=(?<gctime_sys>[\d\.]+), real=(?<gctime_real>[\d\.]+) secs\]/
]
fields.each { |f|
if fields_match = f.match(line)
fields_match.names.each {|name|
record[name] = adjust_type(fields_match[name])
}
end
}
record["type"] = "G1GC"
return record
when /^Total time for which application threads were stopped/
return nil
when /^\[GC.+ParNew: (?<new_before>\d+)K-\>(?<new_after>\d+)K\((?<new_total>\d+)K\), (?<new_gctime>[\d\.]+) secs\] (?<heap_before>\d+)K\-\>(?<heap_after>\d+)K\((?<heap_total>\d+)K\)( icms_dc=(?<icms_dc>\d+) )?, (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "YoungGC"
when /^\[GC \[PSYoungGen: (?<new_before>\d+)K-\>(?<new_after>\d+)K\((?<new_total>\d+)K\)\] (?<heap_before>\d+)K\-\>(?<heap_after>\d+)K\((?<heap_total>\d+)K\), (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "YoungGC"
when /^\[GC \[1 CMS-initial-mark: (?<old_before>\d+)K\((?<old_threshold>\d+)K\)\] (?<heap_before>\d+)K\((?<heap_total>\d+)K\), (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "CMS-initial-mark"
when /^\[GC\[YG occupancy: (?<new_before>\d+) K \((?<new_threshold>\d+) K\)\].+\[1 CMS-remark: (?<old_before>\d+)K\((?<old_threshold>\d+)K\)\] (?<heap_before>\d+)K\((?<heap_total>\d+)K\), (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "CMS-parallel-remark"
when /\[Full GC.+\(concurrent mode failure\).+ (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "FullGC-CMS-failure"
when /\[Full GC.+ (?<gctime>[\d\.]+) secs\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
record["type"] = "FullGC"
when /^\[(?<type>[A-Za-z\-]+)(: (?<time_cpu>[\d\.]+)\/(?<time_wall>[\d\.]+) secs)?\]/
m = Regexp.last_match
record.update(match_fields_to_hash(m))
else
record["type"] = "Unknown"
record["unknown"] = body
end
if m = $'.match('\[Times: user=(?<gctime_user>[\d\.]+) sys=(?<gctime_sys>[\d\.]+), real=(?<gctime_real>[\d\.]+) secs\]')
record.update(match_fields_to_hash(m))
end
return record
end
|