package com.tagtraum.perf.gcviewer.imp;

import com.tagtraum.perf.gcviewer.GCEvent;

/**
 *
 * Date: Feb 12, 2002
 * Time: 4:30:27 PM
 * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
 * @version $Id: $
 */
public class AbstractDataReaderSun {
    public void setMemoryAndPauses(GCEvent event, String line) {
        int end = line.indexOf("K->");
        int start = line.lastIndexOf(' ', end) + 1;
        event.setPreUsed(Long.parseLong(line.substring(start, end)));

        start = end + 3;
        end = line.indexOf('K', start);
        event.setPostUsed(Long.parseLong(line.substring(start, end)));

        start = end + 2;
        end = line.indexOf('K', start);
        event.setTotal(Long.parseLong(line.substring(start, end)));

        start = end + 4;
        end = line.indexOf(' ', start);
        event.setPause(Double.parseDouble(line.substring(start, end).replace(',', '.')));
    }
}
