Pushing traversal engine timer start to as close to actual start as possible
-- Should make initial timings more accurate
This commit is contained in:
parent
6ff432e1f2
commit
d23d620494
|
|
@ -44,7 +44,6 @@ public class LinearMicroScheduler extends MicroScheduler {
|
||||||
* @param shardStrategy A strategy for sharding the data.
|
* @param shardStrategy A strategy for sharding the data.
|
||||||
*/
|
*/
|
||||||
public Object execute(Walker walker, ShardStrategy shardStrategy) {
|
public Object execute(Walker walker, ShardStrategy shardStrategy) {
|
||||||
traversalEngine.startTimers();
|
|
||||||
walker.initialize();
|
walker.initialize();
|
||||||
Accumulator accumulator = Accumulator.create(engine,walker);
|
Accumulator accumulator = Accumulator.create(engine,walker);
|
||||||
|
|
||||||
|
|
@ -54,6 +53,7 @@ public class LinearMicroScheduler extends MicroScheduler {
|
||||||
if ( done || shard == null ) // we ran out of shards that aren't owned
|
if ( done || shard == null ) // we ran out of shards that aren't owned
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
traversalEngine.startTimersIfNecessary();
|
||||||
if(shard.getShardType() == Shard.ShardType.LOCUS) {
|
if(shard.getShardType() == Shard.ShardType.LOCUS) {
|
||||||
LocusWalker lWalker = (LocusWalker)walker;
|
LocusWalker lWalker = (LocusWalker)walker;
|
||||||
WindowMaker windowMaker = new WindowMaker(shard, engine.getGenomeLocParser(), getReadIterator(shard), shard.getGenomeLocs(), engine.getSampleMetadata());
|
WindowMaker windowMaker = new WindowMaker(shard, engine.getGenomeLocParser(), getReadIterator(shard), shard.getGenomeLocs(), engine.getSampleMetadata());
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public class ShardTraverser implements Callable {
|
||||||
|
|
||||||
public Object call() {
|
public Object call() {
|
||||||
try {
|
try {
|
||||||
|
traversalEngine.startTimersIfNecessary();
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
Object accumulator = walker.reduceInit();
|
Object accumulator = walker.reduceInit();
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
|
||||||
LinkedList<ProcessingHistory> history = new LinkedList<ProcessingHistory>();
|
LinkedList<ProcessingHistory> history = new LinkedList<ProcessingHistory>();
|
||||||
|
|
||||||
/** We use the SimpleTimer to time our run */
|
/** We use the SimpleTimer to time our run */
|
||||||
private SimpleTimer timer = new SimpleTimer("Traversal");
|
private SimpleTimer timer = null;
|
||||||
|
|
||||||
// How long can we go without printing some progress info?
|
// How long can we go without printing some progress info?
|
||||||
private static final int PRINT_PROGRESS_CHECK_FREQUENCY_IN_CYCLES = 1000;
|
private static final int PRINT_PROGRESS_CHECK_FREQUENCY_IN_CYCLES = 1000;
|
||||||
|
|
@ -209,11 +209,16 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Should be called to indicate that we're going to process records and the timer should start ticking
|
* Should be called to indicate that we're going to process records and the timer should start ticking. This
|
||||||
|
* function should be called right before any traversal work is done, to avoid counting setup costs in the
|
||||||
|
* processing costs and inflating the estimated runtime.
|
||||||
*/
|
*/
|
||||||
public void startTimers() {
|
public void startTimersIfNecessary() {
|
||||||
timer.start();
|
if ( timer == null ) {
|
||||||
lastProgressPrintTime = timer.currentTime();
|
timer = new SimpleTimer("Traversal");
|
||||||
|
timer.start();
|
||||||
|
lastProgressPrintTime = timer.currentTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue