Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86990e1c authored by LaMont Jones's avatar LaMont Jones Committed by Android (Google) Code Review
Browse files

Merge "Add --apply-only to benchmarks" into main

parents 72bb16aa f50f73f9
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -382,12 +382,16 @@ class Runner():

        # Preroll builds
        for i in range(benchmark.preroll):
            if not self._options.ApplyOnly():
                ns = self._run_build(lunch, benchmark_log_dir.joinpath(f"pre_{i}"), benchmark)
                report.preroll_duration_ns.append(ns)

        sys.stderr.write(f"PERFORMING CHANGE: {benchmark.change.label}\n")
        if not self._options.DryRun():
            benchmark.change.change()
            if self._options.ApplyOnly():
                sys.stderr.write(f"NOT UNDOING CHANGE: {benchmark.change.label}\n")
                return
        try:

            # Measured build
@@ -564,6 +568,8 @@ benchmarks:
                            help="Benchmarks to run.  Default suite will be run if omitted.")
        parser.add_argument("--list", action="store_true",
                            help="list the available benchmarks.  No benchmark is run.")
        parser.add_argument("--apply-only", action="store_true",
                            help="apply the change only, and then exit. Intended only for debugging.")
        parser.add_argument("--dist-one", action="store_true",
                            help="Copy logs and metrics to the given dist dir. Requires that only"
                                + " one benchmark be supplied. Postroll steps will be skipped.")
@@ -585,6 +591,12 @@ benchmarks:
        if self._args.dist_one and len(self.Benchmarks()) != 1:
            self._error("--dist-one requires exactly one --benchmark.")

        # --apply-only forces --iterations=1
        if self.apply_only:
            self.iterations = 1
            if self.dist_one:
              self._error("--dist-one cannot be used with --apply-only.")

        if self._had_error:
            raise FatalError()

@@ -630,6 +642,9 @@ benchmarks:
    def Tag(self):
        return self._args.tag

    def ApplyOnly(self):
        return self._args.apply_only

    def DryRun(self):
        return self._args.dry_run