Repository: microsoft/gctoolkit
File: parser/src/main/java/com/microsoft/gctoolkit/parser/G1GCForwardReference.java (Java)

Code before:
            collection = new G1FullGCNES(getStartTime(), getGCCause(), getDuration());

        // [226.310s][info ][gc,stringtable ] GC(1198) Cleaned string and symbol table, strings: 7394 processed, 0 removed, symbols: 55496 processed, 0 removed
        // [226.310s][debug][gc,phases      ] GC(1198) Scrub String and Symbol Tables 0.451ms.
        //todo: collection.addStringTableSymbolTable();
        //collection.addPermOrMetaSpaceRecord(metaSpaceSummary);
        //[226.310s][debug][gc,phases      ] GC(1198) Class Unloading 3.481ms
        //collection.classUnloading()  todo: fill in
        fillInMemoryPoolStats(collection);
        fullInInternalPhases(collection);
        if (hasReferenceGCSummary())
            collection.add(generateReferenceGCSummary());
        collection.addCPUSummary(getCPUSummary());
        return collection;
    }

    private final Map<String, Double> fullGCInternalPhases = new ConcurrentHashMap<>();
    private final Map<Integer, String> fullGCInternalPhaseOrder = new ConcurrentHashMap<>();

    public void fullPhase(int integerGroup, String fullGCInternalPhase, double duration) {
        fullGCInternalPhaseOrder.put(integerGroup, fullGCInternalPhase);
        fullGCInternalPhases.put(fullGCInternalPhase, duration);
    }

    public String toString() {
        return getStartTime().toString() + " : " + gcType + " : " + getGCCause() + " : " + getDuration();
    }

    public boolean setArchiveOccupancyBeforeCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_OCCUPANCY_BEFORE_COLLECTION, value);
    }

    public boolean setArchiveOccupancyAfterCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_OCCUPANCY_AFTER_COLLECTION, value);
    }

    public boolean setArchiveSizeBeforeCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_SIZE_BEFORE_COLLECTION, value);
    }

    public boolean setArchiveSizeAfterCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_SIZE_AFTER_COLLECTION, value);
    }
}


Review comment (suggestion):
Bikeshedding, but I prefer the order to be type, cause, datetimestamp, duration. My reasoning is that it keeps the two time elements together. The 'record' API that I've put into Aggregations follows that order. 

Code after:
            collection = new G1FullGCNES(getStartTime(), getGCCause(), getDuration());

        // [226.310s][info ][gc,stringtable ] GC(1198) Cleaned string and symbol table, strings: 7394 processed, 0 removed, symbols: 55496 processed, 0 removed
        // [226.310s][debug][gc,phases      ] GC(1198) Scrub String and Symbol Tables 0.451ms.
        //todo: collection.addStringTableSymbolTable();
        //collection.addPermOrMetaSpaceRecord(metaSpaceSummary);
        //[226.310s][debug][gc,phases      ] GC(1198) Class Unloading 3.481ms
        //collection.classUnloading()  todo: fill in
        fillInMemoryPoolStats(collection);
        fullInInternalPhases(collection);
        if (hasReferenceGCSummary())
            collection.add(generateReferenceGCSummary());
        collection.addCPUSummary(getCPUSummary());
        return collection;
    }

    private final Map<String, Double> fullGCInternalPhases = new ConcurrentHashMap<>();
    private final Map<Integer, String> fullGCInternalPhaseOrder = new ConcurrentHashMap<>();

    public void fullPhase(int integerGroup, String fullGCInternalPhase, double duration) {
        fullGCInternalPhaseOrder.put(integerGroup, fullGCInternalPhase);
        fullGCInternalPhases.put(fullGCInternalPhase, duration);
    }

    /**
     * Not that this value will be printed but having toString() defined is useful for debugging. The issue is
     * null values for gctype and gcCause will cause IDE debuggers to NPE. Capture and set to null.
     * @return String rep of this forward reference.
     */
    public String toString() {
        return getStartTime().toString() + " : " + ((gcType == null) ? "null" : gcType.toString()) + " : " + ((getGCCause() == null) ? "null" : getGCCause().toString()) + " : " + getDuration();
    }

    public boolean setArchiveOccupancyBeforeCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_OCCUPANCY_BEFORE_COLLECTION, value);
    }

    public boolean setArchiveOccupancyAfterCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_OCCUPANCY_AFTER_COLLECTION, value);
    }

    public boolean setArchiveSizeBeforeCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_SIZE_BEFORE_COLLECTION, value);
    }

    public boolean setArchiveSizeAfterCollection(int value) {
        return setMemoryPoolMeasurement(ARCHIVE_SIZE_AFTER_COLLECTION, value);
    }
}