return ProfileUtils.mb( mem );
}
public Collection<Result<Task>> profile(String... files) {
KBLoader loader = (loaderType == LoaderType.JENA)
? new JenaLoader()
: new OWLAPILoader();
loader.setIgnoreImports(!imports);
KnowledgeBase kb = loader.getKB();
List<Result<Task>> results = new ArrayList<Result<Task>>();
for( int i = 0; i <= task.ordinal(); i++ ) {
Task task = Task.values()[i];
long start = System.currentTimeMillis();
switch ( task ) {
case Parse:
loader.parse( FileUtils.getFileURIsFromRegex( files ).toArray( new String[0] ) );
break;
case Load:
loader.load();
ProfileUtils.printCounts( kb );
break;
case Consistency:
kb.isConsistent();
ProfileUtils.printCounts( kb.getABox() );
break;
case Classify:
kb.classify();
break;
case Realize:
kb.realize();
break;
default:
throw new AssertionError( "This task does not exist: " + task );
}
double time = (System.currentTimeMillis() - start) / 1000.0;
double mem = task.requiresInstances() && kb.getABox().isEmpty()
? results.get( results.size() - 1 ).getAvgMemory()
: printProfile( kb, loader, "After " + task );
results.add( new Result<Task>( task, mem, time ) );
}
kb.timers.print();
try{
//System.in.read();
} catch(Exception e){
}
loader.clear();
return results;
}