Skip to content

Commit

Permalink
Apply formatting to benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
sesuncedu authored and ignazio1977 committed Feb 25, 2017
1 parent b3d6348 commit d240892
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
Expand Up @@ -7,7 +7,7 @@ public class FullGalenMemoryBenchmark {

public static void main(String[] args) throws Exception {
MemoryBenchmark.memoryProfile(FileSystems.getDefault().getPath(
"/Users/ignazio/full-galen.owl"), FileSystems.getDefault().getPath(
"fullgalen.hprof"));
"/Users/ignazio/full-galen.owl"), FileSystems.getDefault().getPath(
"fullgalen.hprof"));
}
}
Expand Up @@ -10,8 +10,9 @@
public class GazetteerMemoryBenchmark {

public static void main(String[] args) throws Exception {
memoryProfile(FileSystems.getDefault().getPath("/Users/ignazio/gaz-fixed.obo"), FileSystems.getDefault()
.getPath("gazetteer" + new Date() + ".hprof"));
memoryProfile(FileSystems.getDefault().getPath("/Users/ignazio/gaz-fixed.obo"),
FileSystems.getDefault()
.getPath("gazetteer" + new Date() + ".hprof"));
}

public static void memoryProfile(Path ontologyPath, Path hprofPath) throws IOException {
Expand Down
Expand Up @@ -31,7 +31,8 @@ public class MemoryBenchmark {
@SuppressWarnings("javadoc")
public static void main(String[] args) throws Exception {
if (args.length > 2) {
System.err.println("usage: " + MemoryBenchmark.class.getCanonicalName() + "<src-ontology> <dest-hprof>");
System.err.println("usage: " + MemoryBenchmark.class.getCanonicalName()
+ "<src-ontology> <dest-hprof>");
}
String filename = "/Users/ses/ontologies/GO/go.ofn";
if (args.length > 0) {
Expand All @@ -46,17 +47,14 @@ public static void main(String[] args) throws Exception {
/**
* Run memory profiling for an input ontology and output the dump file to
* the hprof path provided
*
* @param ontologyPath
* input ontology
* @param hprofPath
* dump file path for output
* @throws OWLOntologyCreationException
* if the ontology cannot be created or loaded
* @throws IOException
* if the dump file cannot be created
*
* @param ontologyPath input ontology
* @param hprofPath dump file path for output
* @throws OWLOntologyCreationException if the ontology cannot be created or loaded
* @throws IOException if the dump file cannot be created
*/
public static void memoryProfile(Path ontologyPath, Path hprofPath) throws OWLOntologyCreationException,
public static void memoryProfile(Path ontologyPath, Path hprofPath)
throws OWLOntologyCreationException,
IOException {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
File file = ontologyPath.toFile();
Expand All @@ -67,16 +65,19 @@ public static void memoryProfile(Path ontologyPath, Path hprofPath) throws OWLOn
} else {
ds = new FileDocumentSource(file);
}
OWLOntologyLoaderConfiguration config = new OWLOntologyLoaderConfiguration().setStrict(false);
OWLOntologyLoaderConfiguration config = new OWLOntologyLoaderConfiguration()
.setStrict(false);
long start = System.currentTimeMillis();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(ds, config);
System.out.println("MemoryBenchmark.memoryProfile() elapsed: " + (System.currentTimeMillis() - start));
System.out.println(
"MemoryBenchmark.memoryProfile() elapsed: " + (System.currentTimeMillis() - start));
getDiagnostics().dumpHeap(hprofPath.toString(), true);
manager.removeOntology(ontology);
}

protected static HotSpotDiagnosticMXBean getDiagnostics() throws IOException {
HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean = newPlatformMXBeanProxy(getPlatformMBeanServer(),
HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean = newPlatformMXBeanProxy(
getPlatformMBeanServer(),
"com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
for (VMOption vmOption : hotSpotDiagnosticMXBean.getDiagnosticOptions()) {
logger.info("vmOption = {}", vmOption);
Expand All @@ -90,7 +91,8 @@ protected static Path getHprofPath(String[] args, Path ontologyPath) {
hprofPath = FileSystems.getDefault().getPath(args[1]);
} else {
try {
String name = newPlatformMXBeanProxy(getPlatformMBeanServer(), RUNTIME_MXBEAN_NAME, RuntimeMXBean.class)
String name = newPlatformMXBeanProxy(getPlatformMBeanServer(), RUNTIME_MXBEAN_NAME,
RuntimeMXBean.class)
.getName();
String profileFileName = "ontology-hprof-" + name + ".hprof";
hprofPath = ontologyPath.resolveSibling(profileFileName);
Expand Down
Expand Up @@ -10,8 +10,8 @@ public class NCBITaxonMemoryBenchmark {

public static void main(String[] args) throws Exception {
MemoryBenchmark.memoryProfile(
FileSystems.getDefault().getPath(
"/Users/ignazio/workspace/benchmarks/ncbitaxon/src/main/resources/ncbitaxon.rdf.ofn.gz"),
FileSystems.getDefault().getPath("ncbitaxon.hprof"));
FileSystems.getDefault().getPath(
"/Users/ignazio/workspace/benchmarks/ncbitaxon/src/main/resources/ncbitaxon.rdf.ofn.gz"),
FileSystems.getDefault().getPath("ncbitaxon.hprof"));
}
}

0 comments on commit d240892

Please sign in to comment.