All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aiddl.common.scala.execution.clock.TargetFrequencyTicker.scala Maven / Gradle / Ivy

Go to download

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