src/Pure/Build/build_benchmark.scala
author wenzelm
Sun, 10 Aug 2025 22:11:50 +0200
changeset 82982 cbeab5584c62
parent 82752 20ffc02d0b0e
permissions -rw-r--r--
tuned signature: more explicit operations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
79874
1e7b5a258bc5 proper file headers;
wenzelm
parents: 79777
diff changeset
     1
/*  Title:      Pure/Build/build_benchmark.scala
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     2
    Author:     Fabian Huch, TU Muenchen
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     3
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     4
Host platform benchmarks for performance estimation.
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     5
*/
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     6
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     7
package isabelle
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     8
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
     9
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    10
import scala.collection.mutable
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    11
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    12
79620
3914bca631b9 clarified directories;
wenzelm
parents: 79618
diff changeset
    13
object Build_Benchmark {
79625
96bfb554b216 tuned comments;
wenzelm
parents: 79624
diff changeset
    14
  /* benchmark */
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    15
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    16
  def benchmark_session(options: Options) = options.string("build_benchmark_session")
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    17
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    18
  def benchmark_command(
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    19
    options: Options,
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    20
    host: Build_Cluster.Host,
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    21
    ssh: SSH.System = SSH.Local,
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    22
    isabelle_home: Path = Path.current,
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    23
  ): String = {
79932
748c5f344707 always provide build_database_server option in benchmark command;
Fabian Huch <huch@in.tum.de>
parents: 79899
diff changeset
    24
    val benchmark_options =
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    25
      List(
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    26
        Options.Spec.eq("build_hostname", host.name),
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    27
        Options.Spec("build_database_server"),
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    28
        options.spec("build_benchmark_session"))
79624
8e97d1fcbbc2 clarified signature;
wenzelm
parents: 79621
diff changeset
    29
    ssh.bash_path(Isabelle_Tool.exe(isabelle_home)) + " build_benchmark" +
79932
748c5f344707 always provide build_database_server option in benchmark command;
Fabian Huch <huch@in.tum.de>
parents: 79899
diff changeset
    30
      Options.Spec.bash_strings(benchmark_options ::: host.options, bg = true)
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    31
  }
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    32
79641
wenzelm
parents: 79639
diff changeset
    33
  def benchmark_requirements(options: Options, progress: Progress = new Progress): Unit = {
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    34
    val options1 = options.string.update("build_engine", Build.Engine.Default.name)
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    35
    val selection =
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    36
      Sessions.Selection(requirements = true, sessions = List(benchmark_session(options)))
82982
cbeab5584c62 tuned signature: more explicit operations;
wenzelm
parents: 82752
diff changeset
    37
    Build.build(options1, selection = selection, progress = progress, build_heap = true).check
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    38
  }
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    39
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    40
  def run_benchmark(options: Options, progress: Progress = new Progress): Unit = {
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    41
    val hostname = options.string("build_hostname")
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    42
    val store = Store(options)
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    43
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    44
    using(store.open_server()) { server =>
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    45
      using_optional(store.maybe_open_database_server(server = server)) { database_server =>
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    46
        val db = store.open_build_database(path = Host.private_data.database, server = server)
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    47
79617
cdb51c7225ad tuned message;
wenzelm
parents: 79602
diff changeset
    48
        progress.echo("Starting benchmark ...")
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    49
        val benchmark_session_name = benchmark_session(options)
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    50
        val selection = Sessions.Selection(sessions = List(benchmark_session_name))
79657
cff4576218fa tuned: afford untyped/unscoped update;
wenzelm
parents: 79644
diff changeset
    51
        val full_sessions = Sessions.load_structure(options + "threads=1")
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    52
79644
389c1bfa7c3e clarified signature: more standard defaults;
wenzelm
parents: 79642
diff changeset
    53
        val build_deps = Sessions.deps(full_sessions.selection(selection)).check_errors
389c1bfa7c3e clarified signature: more standard defaults;
wenzelm
parents: 79642
diff changeset
    54
        val build_context = Build.Context(store, build_deps, jobs = 1)
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    55
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    56
        val sessions = Build_Process.Sessions.empty.init(build_context, database_server, progress)
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    57
        val session = sessions(benchmark_session_name)
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    58
79682
1fa1b32b0379 build local log_db, with store/restore via optional database server;
wenzelm
parents: 79660
diff changeset
    59
        val hierachy = session.ancestors.map(store.output_session(_, store_heap = true))
79698
b676998d7f97 clarified signature;
wenzelm
parents: 79682
diff changeset
    60
        for (db <- database_server) ML_Heap.restore(db, hierachy, cache = store.cache.compress)
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    61
79660
49475f8bb4cc tuned: afford untyped/unscoped update;
wenzelm
parents: 79657
diff changeset
    62
        val local_options = options + "build_database_server=false" + "build_database=false"
79295
123651f3ec5d restore benchmark requirement heaps properly;
Fabian Huch <huch@in.tum.de>
parents: 79291
diff changeset
    63
123651f3ec5d restore benchmark requirement heaps properly;
Fabian Huch <huch@in.tum.de>
parents: 79291
diff changeset
    64
        benchmark_requirements(local_options, progress)
79698
b676998d7f97 clarified signature;
wenzelm
parents: 79682
diff changeset
    65
        for (db <- database_server) ML_Heap.restore(db, hierachy, cache = store.cache.compress)
79295
123651f3ec5d restore benchmark requirement heaps properly;
Fabian Huch <huch@in.tum.de>
parents: 79291
diff changeset
    66
80125
wenzelm
parents: 80124
diff changeset
    67
        def get_shasum(name: String): SHA1.Shasum =
wenzelm
parents: 80124
diff changeset
    68
          store.check_output(database_server, name,
wenzelm
parents: 80124
diff changeset
    69
            sources_shasum = sessions(name).sources_shasum,
82752
20ffc02d0b0e clarified modules;
wenzelm
parents: 82720
diff changeset
    70
            input_shasum = store.make_shasum(sessions(name).ancestors.map(get_shasum)),
80128
2fe244c4bb01 clarified signature;
wenzelm
parents: 80125
diff changeset
    71
            build_thorough = build_context.sessions_structure(name).build_thorough)._2
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    72
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    73
        val deps = Sessions.deps(full_sessions.selection(selection)).check_errors
79948
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    74
        val background = deps.background(benchmark_session_name)
8fe1ed4b5705 option for benchmark session;
Fabian Huch <huch@in.tum.de>
parents: 79947
diff changeset
    75
        val input_shasum = get_shasum(benchmark_session_name)
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    76
        val node_info = Host.Node_Info(hostname, None, Nil)
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    77
79295
123651f3ec5d restore benchmark requirement heaps properly;
Fabian Huch <huch@in.tum.de>
parents: 79291
diff changeset
    78
        val local_build_context = build_context.copy(store = Store(local_options))
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    79
79887
17220dc05991 revert most parts of 0e79fa88cab6: somewhat ambitious attempt to move towards "editing" builds via added/canceled workers;
wenzelm
parents: 79874
diff changeset
    80
        val result =
79777
db9c6be8e236 prefer dynamic objects, following a5fda30edae2;
wenzelm
parents: 79698
diff changeset
    81
          Build_Job.start_session(local_build_context, session, progress, new Logger, server,
79887
17220dc05991 revert most parts of 0e79fa88cab6: somewhat ambitious attempt to move towards "editing" builds via added/canceled workers;
wenzelm
parents: 79874
diff changeset
    82
            background, session.sources_shasum, input_shasum, node_info, false).join
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    83
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    84
        val timing =
79887
17220dc05991 revert most parts of 0e79fa88cab6: somewhat ambitious attempt to move towards "editing" builds via added/canceled workers;
wenzelm
parents: 79874
diff changeset
    85
          if (result.process_result.ok) result.process_result.timing
17220dc05991 revert most parts of 0e79fa88cab6: somewhat ambitious attempt to move towards "editing" builds via added/canceled workers;
wenzelm
parents: 79874
diff changeset
    86
          else error("Failed to build benchmark session")
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    87
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    88
        val score = Time.seconds(1000).ms.toDouble / (1 + timing.elapsed.ms)
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    89
        progress.echo(
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    90
          "Finished benchmark in " + timing.message + ". Score: " + String.format("%.2f", score))
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    91
79602
9ba800f12785 clarified signature;
wenzelm
parents: 79295
diff changeset
    92
        Host.write_info(db, Host.Info.init(hostname = hostname, score = Some(score)))
79291
e9a788a75775 use single-threaded session build as benchmark (using ZF-Constructible);
Fabian Huch <huch@in.tum.de>
parents: 78916
diff changeset
    93
      }
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    94
    }
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    95
  }
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
    96
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    97
  def benchmark(
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    98
    options: Options,
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
    99
    build_hosts: List[Build_Cluster.Host] = Nil,
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   100
    progress: Progress = new Progress
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   101
  ): Unit =
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   102
    if (build_hosts.isEmpty) run_benchmark(options, progress)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   103
    else {
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   104
      val engine = Build.Engine.Default
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   105
      val store = engine.build_store(options, build_cluster = true)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   106
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   107
      benchmark_requirements(store.options, progress)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   108
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   109
      val deps0 = Sessions.deps(Sessions.load_structure(options))
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   110
      val build_context = Build.Context(store, deps0, build_hosts = build_hosts)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   111
79949
bc39a468ace6 raise error if benchmarking fails;
Fabian Huch <huch@in.tum.de>
parents: 79948
diff changeset
   112
      val build_cluster = Build_Cluster.make(build_context, progress).open().init().benchmark()
bc39a468ace6 raise error if benchmarking fails;
Fabian Huch <huch@in.tum.de>
parents: 79948
diff changeset
   113
      if (!build_cluster.ok) error("Benchmarking failed")
bc39a468ace6 raise error if benchmarking fails;
Fabian Huch <huch@in.tum.de>
parents: 79948
diff changeset
   114
      build_cluster.stop()
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   115
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   116
      using(store.open_server()) { server =>
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   117
        val db = store.open_build_database(path = Host.private_data.database, server = server)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   118
        for (build_host <- build_hosts) {
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   119
          val score =
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   120
            (for {
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   121
              info <- Host.read_info(db, build_host.name)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   122
              score <- info.benchmark_score
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   123
            } yield score).getOrElse(error("No score for host " + quote(build_host.name)))
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   124
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   125
          progress.echo(build_host.name + ": " + score)
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   126
        }
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   127
      }
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   128
    }
79625
96bfb554b216 tuned comments;
wenzelm
parents: 79624
diff changeset
   129
96bfb554b216 tuned comments;
wenzelm
parents: 79624
diff changeset
   130
  /* Isabelle tool wrapper */
96bfb554b216 tuned comments;
wenzelm
parents: 79624
diff changeset
   131
79620
3914bca631b9 clarified directories;
wenzelm
parents: 79618
diff changeset
   132
  val isabelle_tool = Isabelle_Tool("build_benchmark", "run benchmark for build process",
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   133
    Scala_Project.here,
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   134
    { args =>
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   135
      val build_hosts = new mutable.ListBuffer[Build_Cluster.Host]
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   136
      var options = Options.init()
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   137
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   138
      val getopts = Getopts("""
79620
3914bca631b9 clarified directories;
wenzelm
parents: 79618
diff changeset
   139
Usage: isabelle build_benchmark [OPTIONS]
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   140
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   141
  Options are:
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   142
    -H HOSTS     additional cluster host specifications of the form
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   143
                 NAMES:PARAMETERS (separated by commas)
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   144
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   145
79620
3914bca631b9 clarified directories;
wenzelm
parents: 79618
diff changeset
   146
  Run benchmark for build process.
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   147
""",
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   148
        "H:" -> (arg => build_hosts ++= Build_Cluster.Host.parse(Registry.global, arg)),
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   149
        "o:" -> (arg => options = options + arg))
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   150
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   151
      val more_args = getopts(args)
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   152
      if (more_args.nonEmpty) getopts.usage()
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   153
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   154
      val progress = new Console_Progress()
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   155
79947
5eb90c1ce653 add hosts option to run benchmark on the cluster from the command-line;
Fabian Huch <huch@in.tum.de>
parents: 79932
diff changeset
   156
      benchmark(options, build_hosts = build_hosts.toList, progress = progress)
78840
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   157
    })
4b528ca25573 added initial version of benchmark module, e.g., to compare performance of different hosts;
Fabian Huch <huch@in.tum.de>
parents:
diff changeset
   158
}