diff --git a/gc_log_visualizer.py b/gc_log_visualizer.py index 2c944e4..9772dc9 100644 --- a/gc_log_visualizer.py +++ b/gc_log_visualizer.py @@ -2,10 +2,10 @@ import sys import re -import tempfile import os import dateutil.parser + class StwSubTimings: def __init__(self): self.reset() @@ -24,6 +24,7 @@ def unknown_time(self, total): else: return 0 + class LogParser: heapG1GCPattern = '\s*\[Eden: ([0-9.]+)([BKMG])\(([0-9.]+)([BKMG])\)->[0-9.BKMG()]+ Survivors: ([0-9.]+)([BKMG])->([0-9.]+)([BKMG]) Heap: ([0-9.]+)([BKMG])\([0-9.BKMG]+\)->([0-9.]+)([BKMG])\([0-9.BKMG]+\)' parallelPattern = '\s*\[PSYoungGen: ([0-9.]+)([BKMG])->([0-9.]+)([BKMG])\([0-9.MKBG]+\)\] ([0-9.]+)([MKBG])->([0-9.]+)([MKBG])\([0-9.MKBG]+\),' @@ -71,7 +72,7 @@ def __init__(self, input_file): self.full_gc = False self.gc = False self.root_scan_start_time = 0 - self.root_scan_end_timestamp = 0 + self.root_scan_end_timestamp = None self.root_scan_mark_end_time = 0 self.mixed_duration_start_time = 0 self.mixed_duration_count = 0 @@ -348,7 +349,7 @@ def parse_log(self): def output_data(self): if self.mixed_duration_count == 0: - self.young_pause_file.write("%s %.6f\n" % (self.timestamp_string(), self.pause_time)) + self.young_pause_file.write(f"{self.timestamp_string()} {self.pause_time}.6f\n") else: self.mixed_pause_file.write("%s %.6f\n" % (self.timestamp_string(), self.pause_time))