in tools/owperf/owperf.js [337:390]
async function mainLoop() {
var warmupCounter = testRecord.input.warmup;
const delta = ((cluster.isWorker || !testRecord.input.master_delta) ? testRecord.input.delta : testRecord.input.master_delta);
const blocking = ((cluster.isWorker || !testRecord.input.master_blocking) ? testRecord.input.blocking : testRecord.input.master_blocking);
const doBlocking = (blocking != NONE);
const getResult = (blocking == RESULT);
while (!abort) {
// ----
// Pass init (worker - send message) after <warmup> iterations
if (warmupCounter == 0) {
if (cluster.isMaster)
checkInit();
else // worker - send init
process.send({init: 1});
}
if (warmupCounter >= 0) // take 0 down to -1 to make sure it does not trigger another init message
warmupCounter--;
// ----
// If iterations limit set, abort loop when finished iterations
if (remainingIterations == 0) {
abortLoop();
continue;
}
if (remainingIterations > 0)
remainingIterations--;
const si = new Date().getTime(); // SI = Start of Iteration timestamp
var samples;
if (activity == ACTION)
samples = await invokeActions(testRecord.input.ratio, doBlocking, getResult, si);
else
samples = await invokeRules(si);
samples.forEach(sample => {
sampleData.push(sample);
});
const ei = new Date().getTime(); // EI = End of Iteration timestamp
const duration = ei - si;
if (delta > duration) {
loopSleeper = sleep(delta - duration);
if (!abort) // check again to avoid race condition on loopSleeper
await loopSleeper;
}
}
}