better estimation for unknown jobs;
authorFabian Huch <huch@in.tum.de>
Fri, 24 Nov 2023 17:06:32 +0100
changeset 79038 cd7c1acc9cf2
parent 79037 1b3a6cc4a2bf
child 79039 322bcfce2b37
better estimation for unknown jobs;
src/Pure/Tools/build_schedule.scala
--- a/src/Pure/Tools/build_schedule.scala	Fri Nov 24 17:05:49 2023 +0100
+++ b/src/Pure/Tools/build_schedule.scala	Fri Nov 24 17:06:32 2023 +0100
@@ -156,7 +156,16 @@
 
     def estimate(job_name: String, hostname: String, threads: Int): Time =
       data.by_job.get(job_name) match {
-        case None => data.mean_time
+        case None =>
+          // no data for job, take average of other jobs for given threads
+          val job_estimates = data.by_job.keys.flatMap(estimate_threads(_, hostname, threads))
+          if (job_estimates.nonEmpty) Timing_Data.mean_time(job_estimates)
+          else {
+            // no other job to estimate from, use global curve to approximate any other job
+            val (threads1, data1) = data.by_threads.head
+            data1.mean_time.scale(global_threads_factor(threads1, threads))
+          }
+
         case Some(data) =>
           data.by_threads.get(threads) match {
             case None => // interpolate threads