diff --git a/Akka/src/main/scala/core/DriverImpl.scala b/Akka/src/main/scala/core/DriverImpl.scala index 95ba851a..ece1d68b 100644 --- a/Akka/src/main/scala/core/DriverImpl.scala +++ b/Akka/src/main/scala/core/DriverImpl.scala @@ -129,7 +129,11 @@ class Driver { case LogControllerFinished() => Behaviors.stopped {() => - ctx.log.info(f"Average ${(end-initialStart)/(currentTurn-1)} ms") + if (currentTurn > 1) { + ctx.log.info(f"Average ${(end-initialStart)/(currentTurn)} ms") + } else { + ctx.log.info(f"Average ${end-initialStart} ms") + } ctx.log.debug(f"Simulation completes! Stop the driver") workersStop.foreach(a => a ! WorkerSpec.Stop()) } diff --git a/Base/src/main/scala/Simulate.scala b/Base/src/main/scala/Simulate.scala index 6cd5cda5..ede9b152 100644 --- a/Base/src/main/scala/Simulate.scala +++ b/Base/src/main/scala/Simulate.scala @@ -48,7 +48,11 @@ object Simulate { end = System.currentTimeMillis() println(f"Round ${currentRound} takes ${end-start} ms") } - println(f"Average ${(end - initial)/totalRound} ms") + if (totalRound >= 1) { + println(f"Average ${(end - initial)/totalRound} ms") + } else { + println(f"Average ${end - initial} ms") + } SimulationSnapshot(actors, collectedMessages.flatMap(i => i._2).toList) } }