use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.
the class DataReaderFacade method loadModel.
/**
* Loads a model from a given <code>gcResource</code> logging all exceptions that occur.
*
* @param gcResource where to find data to be parsed
* @return instance of GCModel containing all information that was parsed
* @throws DataReaderException if any exception occurred, it is logged and added as the cause
* to this exception
*/
public GCModel loadModel(GCResource gcResource) throws DataReaderException {
if (gcResource == null) {
throw new NullPointerException("gcResource must never be null");
}
if (gcResource instanceof GcResourceSeries) {
return loadModelFromSeries((GcResourceSeries) gcResource);
}
if (!(gcResource instanceof GcResourceFile))
throw new UnsupportedOperationException("Only supported for files!");
DataReaderException dataReaderException = new DataReaderException();
GCModel model = null;
Logger logger = gcResource.getLogger();
try {
logger.info("GCViewer version " + BuildInfoReader.getVersion() + " (" + BuildInfoReader.getBuildDate() + ")");
model = readModel((GcResourceFile) gcResource);
} catch (RuntimeException | IOException e) {
dataReaderException.initCause(e);
logger.warning(LocalisationHelper.getString("fileopen_dialog_read_file_failed") + "\n" + e.toString() + " " + e.getLocalizedMessage());
}
if (dataReaderException.getCause() != null) {
throw dataReaderException;
}
return model;
}
use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.
the class GCViewerTest method singleArgumentOpensGui.
@Test
public void singleArgumentOpensGui() throws Exception {
GCViewerGuiController controller = mock(GCViewerGuiController.class);
GCViewer gcViewer = new GCViewer(controller, new GCViewerArgsParser());
String[] args = { "some_gc.log" };
gcViewer.doMain(args);
verify(controller).startGui(new GcResourceFile("some_gc.log"));
assertThat(outContent.toString(), isEmptyString());
assertThat(errContent.toString(), isEmptyString());
}
use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.
the class ImportPerformanceTest method main.
public static void main(String[] args) throws IOException, InterruptedException {
IntData performanceData = new IntData();
for (int i = 0; i < 10; i++) {
long start = System.currentTimeMillis();
DataReader dataReader = new DataReaderFactory().getDataReader(new GcResourceFile(args[0]), new FileInputStream(args[0]));
dataReader.read();
performanceData.add((int) (System.currentTimeMillis() - start));
}
printIntData(args[0], performanceData);
}
use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.
the class GCResourceGroup method getGcResourceSeries.
private GCResource getGcResourceSeries(String entry) {
GCResource resource;
List<GCResource> series = new ArrayList<>();
for (String s : entry.split(SERIES_SEPARATOR)) {
series.add(new GcResourceFile(s));
}
resource = new GcResourceSeries(series);
return resource;
}
use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.
the class TestDataReaderSun1_6_0 method testPrintCmsStatisticsRemark.
@Test
public void testPrintCmsStatisticsRemark() throws Exception {
ByteArrayInputStream in = new ByteArrayInputStream(("2012-10-20T18:04:59.443+0200: 2.918: [GC[YG occupancy: 8752 K (78656 K)]2.918: [Rescan (parallel) (Survivor:1chunks) Finished young gen rescan work in 2th thread: 0.000 sec" + "\nFinished young gen rescan work in 1th thread: 0.000 sec" + "\nFinished young gen rescan work in 0th thread: 0.000 sec" + "\nFinished remaining root rescan work in 1th thread: 0.000 sec" + "\nFinished remaining root rescan work in 2th thread: 0.000 sec" + "\nFinished remaining root rescan work in 0th thread: 0.000 sec" + "\nFinished dirty card rescan work in 0th thread: 0.001 sec" + "\nFinished dirty card rescan work in 2th thread: 0.001 sec" + "\nFinished dirty card rescan work in 1th thread: 0.001 sec" + "\nFinished young gen rescan work in 3th thread: 0.000 sec" + "\nFinished remaining root rescan work in 3th thread: 0.000 sec" + "\nFinished dirty card rescan work in 3th thread: 0.000 sec" + "\nFinished work stealing in 3th thread: 0.000 sec" + "\nFinished work stealing in 2th thread: 0.000 sec" + "\nFinished work stealing in 0th thread: 0.000 sec" + "\nFinished work stealing in 1th thread: 0.000 sec" + "\n, 0.0008918 secs]2.919: [weak refs processing, 0.0000057 secs]2.919: [class unloading, 0.0001020 secs]2.919: [scrub symbol & string tables, 0.0003265 secs] [1 CMS-remark: 376134K(436928K)] 384886K(515584K), 0.0014952 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]").getBytes());
DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
GCModel model = reader.read();
assertEquals("GC count", 1, model.size());
assertEquals("GC pause", 0.0014952, model.getGCPause().getMin(), 0.000000001);
}
Aggregations