Organized performance monitoring passes unit tests and is more efficient

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4924 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2011-01-03 02:09:08 +00:00
parent c51e745bae
commit d31c658c2e
1 changed files with 9 additions and 12 deletions

View File

@ -127,18 +127,6 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
//
// code to process the performance log
//
// TODO -- should be controlled by Queue so that .out and .performance.log comes out
//
if ( PERFORMANCE_LOG_ENABLED && performanceLog == null
&& engine != null && engine.getArguments().performanceLog != null ) {
try {
performanceLog = new PrintStream(new FileOutputStream(engine.getArguments().performanceLog));
performanceLog.println(Utils.join("\t", Arrays.asList("elapsed.time", "units.processed", "processing.speed")));
} catch (FileNotFoundException e) {
throw new UserException.CouldNotCreateOutputFile(engine.getArguments().performanceLog, e);
}
}
if ( performanceLog != null && maxElapsedIntervalForPrinting(curTime, lastPerformanceLogPrintTime, PERFORMANCE_LOG_PRINT_FREQUENCY)) {
lastPerformanceLogPrintTime = curTime;
if ( nRecords > 1 ) performanceLog.printf("%.2f\t%d\t%.2f%n", elapsed, nRecords, secsPer1MReads);
@ -180,6 +168,15 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
*/
public void initialize(GenomeAnalysisEngine engine) {
this.engine = engine;
if ( PERFORMANCE_LOG_ENABLED && engine != null && engine.getArguments() != null && engine.getArguments().performanceLog != null ) {
try {
performanceLog = new PrintStream(new FileOutputStream(engine.getArguments().performanceLog));
performanceLog.println(Utils.join("\t", Arrays.asList("elapsed.time", "units.processed", "processing.speed")));
} catch (FileNotFoundException e) {
throw new UserException.CouldNotCreateOutputFile(engine.getArguments().performanceLog, e);
}
}
}
/**