Skip to content

Instantly share code, notes, and snippets.

@siddontang
Created May 26, 2018 03:51
Show Gist options
  • Save siddontang/3c05f699e12d90189defbbdbf78ba420 to your computer and use it in GitHub Desktop.
Save siddontang/3c05f699e12d90189defbbdbf78ba420 to your computer and use it in GitHub Desktop.
private void throttleNanos(long startTimeNanos) {
//throttle the operations
if (_targetOpsPerMs > 0)
{
// delay until next tick
long deadline = startTimeNanos + _opsdone*_targetOpsTickNs;
sleepUntil(deadline);
_measurements.setIntendedStartTimeNs(deadline);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment