use of com.tagtraum.perf.gcviewer.model.AbstractGCEvent in project GCViewer by chewiebug.
the class DataReaderSun1_6_0G1 method parseLine.
@Override
protected AbstractGCEvent<?> parseLine(String line, ParseInformation pos) throws ParseException {
AbstractGCEvent<?> ae = null;
try {
// parse datestamp "yyyy-MM-dd'T'hh:mm:ssZ:"
// parse timestamp "double:"
// parse collection type "[TYPE"
// pre-used->post-used, total, time
ZonedDateTime datestamp = parseDatestamp(line, pos);
double timestamp = getTimestamp(line, pos, datestamp);
ExtendedType type = parseType(line, pos);
// special provision for concurrent events
if (type.getConcurrency() == Concurrency.CONCURRENT) {
ae = parseConcurrentEvent(line, pos, datestamp, timestamp, type);
} else if (type.getCollectionType().equals(CollectionType.VM_OPERATION)) {
ae = new VmOperationEvent();
VmOperationEvent vmOpEvent = (VmOperationEvent) ae;
vmOpEvent.setDateStamp(datestamp);
vmOpEvent.setTimestamp(timestamp);
vmOpEvent.setExtendedType(type);
vmOpEvent.setPause(parsePause(line, pos));
} else {
ae = new GCEvent();
GCEvent event = (GCEvent) ae;
event.setDateStamp(datestamp);
event.setTimestamp(timestamp);
event.setExtendedType(type);
// Java 7 can have detailed event at this position like this
// 0.197: [GC remark 0.197: [GC ref-proc, 0.0000070 secs], 0.0005297 secs]
// or when PrintDateTimeStamps is on like:
// 2013-09-09T06:45:45.825+0000: 83146.942: [GC remark 2013-09-09T06:45:45.825+0000: 83146.943: [GC ref-proc, 0.0069100 secs], 0.0290090 secs]
parseDetailEventsIfExist(line, pos, event);
if (event.getExtendedType().getPattern() == GcPattern.GC_MEMORY_PAUSE) {
setMemoryAndPauses(event, line, pos);
} else {
event.setPause(parsePause(line, pos));
}
}
return ae;
} catch (RuntimeException rte) {
throw new ParseException(rte.toString(), line, pos);
}
}
use of com.tagtraum.perf.gcviewer.model.AbstractGCEvent in project GCViewer by chewiebug.
the class GcSeriesLoader method mergeModels.
private GCModel mergeModels(List<GCModel> models) {
GCModel mergedModel = models.get(0);
for (int i = 1; i < models.size(); i++) {
GCModel model = models.get(i);
Iterator<AbstractGCEvent<?>> iterator = model.getEvents();
while (iterator.hasNext()) {
mergedModel.add(iterator.next());
}
}
// Use URL of last contained file. In case of a refresh this is the only file that can have changed
mergedModel.setURL(models.get(models.size() - 1).getURL());
return mergedModel;
}
use of com.tagtraum.perf.gcviewer.model.AbstractGCEvent in project GCViewer by chewiebug.
the class CSVTSDataWriter method write.
/**
* Writes the model and flushes the internal PrintWriter.
*/
public void write(GCModel model) throws IOException {
writeHeader();
Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents();
while (i.hasNext()) {
AbstractGCEvent<?> abstractGCEvent = i.next();
// filter "application stopped" events
if (abstractGCEvent instanceof GCEvent) {
GCEvent event = (GCEvent) abstractGCEvent;
// If the true timestamp is present, output the unix timestamp
if (model.hasDateStamp()) {
out.print(event.getDatestamp().toInstant().getEpochSecond());
} else if (model.hasCorrectTimestamp()) {
// we have the timestamps therefore we can correct it with the pause time
out.print((event.getTimestamp() - event.getPause()));
} else {
out.print(event.getTimestamp());
}
out.print(',');
// pre
out.print(event.getPreUsed());
out.print(',');
out.print(event.getTotal());
out.print(',');
out.print(event.getPause());
out.print(',');
out.println(event.getExtendedType());
}
}
out.flush();
}
use of com.tagtraum.perf.gcviewer.model.AbstractGCEvent in project GCViewer by chewiebug.
the class SimpleGcWriter method write.
/**
* @see com.tagtraum.perf.gcviewer.exp.AbstractDataWriter#write(com.tagtraum.perf.gcviewer.model.GCModel)
*/
@Override
public void write(GCModel model) throws IOException {
Iterator<AbstractGCEvent<?>> i = model.getEvents();
final Locale NO_LOCALE = null;
while (i.hasNext()) {
AbstractGCEvent<?> abstractEvent = i.next();
if (abstractEvent.isStopTheWorld()) {
out.printf(NO_LOCALE, "%s %f %f%n", getSimpleType(abstractEvent), abstractEvent.getTimestamp(), abstractEvent.getPause());
}
}
out.flush();
}
use of com.tagtraum.perf.gcviewer.model.AbstractGCEvent in project GCViewer by chewiebug.
the class DataReaderIBM1_3_0 method read.
public GCModel read() throws IOException {
if (getLogger().isLoggable(Level.INFO))
getLogger().info("Reading IBM 1.3.0 format...");
try {
GCModel model = new GCModel();
model.setFormat(GCModel.Format.IBM_VERBOSE_GC);
int state = 0;
String line = null;
AbstractGCEvent<GCEvent> lastEvent = new GCEvent();
GCEvent event = null;
while ((line = in.readLine()) != null && shouldContinue()) {
String trimmedLine = line.trim();
if ((!trimmedLine.equals("")) && (!trimmedLine.startsWith("<GC: ")) && (!(trimmedLine.startsWith("<") && trimmedLine.endsWith(">")))) {
if (getLogger().isLoggable(Level.WARNING))
getLogger().warning("Malformed line (" + in.getLineNumber() + "): " + line);
state = 0;
}
switch(state) {
case 0:
if (line.indexOf("Allocation Failure.") != -1) {
event = new GCEvent();
event.setType(AbstractGCEvent.Type.FULL_GC);
event.setTimestamp(lastEvent.getTimestamp() + parseTimeSinceLastAF(line));
state++;
break;
}
case 1:
if (line.indexOf("managing allocation failure, action=1") != -1) {
event.setPreUsed(parsePreUsed(line));
state++;
break;
}
case 2:
if (line.indexOf("freed") != -1 && line.indexOf("unloaded") == -1) {
event.setPostUsed(parsePostUsed(line));
event.setTotal(parseTotalAfterGC(line));
state++;
break;
}
case 3:
if (line.indexOf("expanded heap by ") != -1) {
event.setTotal(parseTotalAfterHeapExpansion(line));
state++;
break;
}
case 4:
if (line.indexOf("completed in ") != -1) {
event.setPause(parsePause(line));
model.add(event);
lastEvent = event;
event = null;
state = 0;
}
default:
}
}
return model;
} finally {
if (in != null)
try {
in.close();
} catch (IOException ioe) {
}
if (getLogger().isLoggable(Level.INFO))
getLogger().info("Reading done.");
}
}
Aggregations