org.aiddl.common.scala.execution.clock.TargetFrequencyTicker.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aiddl-common-scala Show documentation
Show all versions of aiddl-common-scala Show documentation
Provides common types and algorithm implementations for the fast prototyping integrative AI systems with the AIDDL framework.
The newest version!
package org.aiddl.common.scala.execution.clock
class TargetFrequencyTicker(targetDur: Long) {
var target: Tickable = _
def run: Unit = {
var delay: Long = 0
var st: Long = 0
var dur: Long = 0
while { true } do {
st = System.nanoTime
target.tick
dur = System.nanoTime - st
delay = Math.max(0, {{targetDur - dur}/1000000}.toInt)
Thread.sleep(delay)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy