- java.lang.Object
-
- com.microsoft.gctoolkit.io.GCLogFileSegment
-
- All Implemented Interfaces:
LogFileSegment
public class GCLogFileSegment extends Object implements LogFileSegment
ARotatingGCLogFileis made up ofGarbageCollectionLogFileSegments. Creating aGarbageCollectionLogFileSegmentis not necessary when theRotatingGCLogFile(Path)constructor is used. The { @ link RotatingGCLogFile # RotatingGCLogFile(Path, List) } constructor allows the user to provide a list of discreteGarbageCollectionLogFileSegements for aRotatingGCLogFile.
-
-
Field Summary
-
Fields inherited from interface com.microsoft.gctoolkit.io.LogFileSegment
ROTATING_LOG_PATTERN, ROTATING_LOG_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description GCLogFileSegment(Path path)The constructor attempts to extract the segment index from the file name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetEndTime()return some comparable value for the last time found in the log.PathgetPath()Return the path to the file.intgetSegmentIndex()The segment index is the integer appended to the file name.StringgetSegmentName()doublegetStartTime()return some comparable value for the first time found in the log.booleanisCurrent()Returntrueif the log file segment was the file being written to.Stream<String>stream()Stream the file, one line at a time.StringtoString()
-
-
-
Constructor Detail
-
GCLogFileSegment
public GCLogFileSegment(Path path)
The constructor attempts to extract the segment index from the file name.- Parameters:
path- The path to the file.
-
-
Method Detail
-
getPath
public Path getPath()
Return the path to the file.- Specified by:
getPathin interfaceLogFileSegment- Returns:
- The path to the file.
-
getSegmentName
public String getSegmentName()
- Specified by:
getSegmentNamein interfaceLogFileSegment
-
getStartTime
public double getStartTime()
return some comparable value for the first time found in the log. If isn't found, then return min value. This combined with the end time being a max value implies the log covers an impossible amount of time. The sorting logic in the Metadata classes should filter out these types of segments.- Specified by:
getStartTimein interfaceLogFileSegment- Returns:
- double representing either the age of the JVM or time from epoch if only a date stamp is found at the beginning of the log file
-
getEndTime
public double getEndTime()
return some comparable value for the last time found in the log. If isn't found, then return max value. This combined with the start time implies the log covers an impossible amount of time. The sorting logic in the Metadata classes should filter out these types of segments.- Specified by:
getEndTimein interfaceLogFileSegment- Returns:
- double representing either the age of the JVM or time from epoch if only a date stamp is found at the end of the log file
-
getSegmentIndex
public int getSegmentIndex()
The segment index is the integer appended to the file name. If the file name does not have a segment index, thenInteger.MAX_VALUEis returned.- Returns:
- The segment index, or
Integer.MAX_VALUEif the file does not have a segment index.
-
stream
public Stream<String> stream()
Stream the file, one line at a time.- Specified by:
streamin interfaceLogFileSegment- Returns:
- A stream of lines from the file.
-
isCurrent
public boolean isCurrent()
Returntrueif the log file segment was the file being written to.- Returns:
trueif the log file segment was the current file.
-
-