forked from worldfnd/provekit
-
Notifications
You must be signed in to change notification settings - Fork 0
Run main-based mobench fixtures on low-end devices #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7cee8b0
ci: add oprf and p256 mobench fixtures
b90b308
ci: harden mobench sticky comment reporting
c94bc39
ci: run mobench smoke on low-end devices
c5caecc
fix: refresh mobench fixtures for main
65489af
fix: use compatible low-end mobench devices
7ef0833
fix: lower ios mobench deployment target
caa5338
fix: support low-end mobench CI runs
fee5c49
fix: use UIKit mobench runner for iOS 10
6f132d0
fix: avoid ios 11 json option in mobench runner
5dd8311
fix: run iphone 7 mobench on supported ios
9839862
fix: keep iphone 7 browserstack inventory target
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import UIKit | ||
|
|
||
| @UIApplicationMain | ||
| final class BenchRunnerApp: UIResponder, UIApplicationDelegate { | ||
| var window: UIWindow? | ||
|
|
||
| func application( | ||
| _ application: UIApplication, | ||
| didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
| ) -> Bool { | ||
| let window = UIWindow(frame: UIScreen.main.bounds) | ||
| window.rootViewController = BenchRunnerViewController() | ||
| window.makeKeyAndVisible() | ||
| self.window = window | ||
| return true | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| import UIKit | ||
|
|
||
| private struct ProfileLaunchOptions { | ||
| let benchDelayMs: UInt64 | ||
| let resultHoldMs: UInt64 | ||
| let repeatUntilMs: UInt64 | ||
| let warmupOnly: Bool | ||
|
|
||
| static func resolved() -> ProfileLaunchOptions { | ||
| let info = ProcessInfo.processInfo | ||
|
|
||
| var benchDelayMs = UInt64(info.environment["MOBENCH_BENCH_DELAY_MS"] ?? "0") ?? 0 | ||
| var resultHoldMs = UInt64( | ||
| info.environment["MOBENCH_PROFILE_RESULT_HOLD_MS"] ?? "5000" | ||
| ) ?? 5000 | ||
| var repeatUntilMs = UInt64( | ||
| info.environment["MOBENCH_PROFILE_REPEAT_UNTIL_MS"] ?? "0" | ||
| ) ?? 0 | ||
| var warmupOnly = info.environment["MOBENCH_PROFILE_WARMUP_ONLY"] == "1" | ||
|
|
||
| for arg in info.arguments { | ||
| if arg.hasPrefix("--mobench-profile-bench-delay-ms="), | ||
| let value = arg.split(separator: "=", maxSplits: 1).last, | ||
| let parsed = UInt64(value) { | ||
| benchDelayMs = parsed | ||
| } else if arg.hasPrefix("--mobench-profile-result-hold-ms="), | ||
| let value = arg.split(separator: "=", maxSplits: 1).last, | ||
| let parsed = UInt64(value) { | ||
| resultHoldMs = parsed | ||
| } else if arg.hasPrefix("--mobench-profile-repeat-until-ms="), | ||
| let value = arg.split(separator: "=", maxSplits: 1).last, | ||
| let parsed = UInt64(value) { | ||
| repeatUntilMs = parsed | ||
| } else if arg == "--mobench-profile-warmup-only" | ||
| || arg == "--mobench-profile-warmup-only=1" { | ||
| warmupOnly = true | ||
| } | ||
| } | ||
|
|
||
| NSLog( | ||
| "[BenchRunner] Profile launch options: delayMs=%llu, repeatUntilMs=%llu, resultHoldMs=%llu, warmupOnly=%@", | ||
| benchDelayMs, | ||
| repeatUntilMs, | ||
| resultHoldMs, | ||
| warmupOnly ? "true" : "false" | ||
| ) | ||
|
|
||
| return ProfileLaunchOptions( | ||
| benchDelayMs: benchDelayMs, | ||
| resultHoldMs: resultHoldMs, | ||
| repeatUntilMs: repeatUntilMs, | ||
| warmupOnly: warmupOnly | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| final class BenchRunnerViewController: UIViewController { | ||
| private let reportLabel = UILabel() | ||
| private let completedLabel = UILabel() | ||
| private let jsonLabel = UILabel() | ||
| private let stack = UIStackView() | ||
| private var started = false | ||
|
|
||
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
| view.backgroundColor = .white | ||
|
|
||
| reportLabel.accessibilityIdentifier = "benchmarkReport" | ||
| reportLabel.font = UIFont(name: "Menlo", size: 13) ?? UIFont.systemFont(ofSize: 13) | ||
| reportLabel.numberOfLines = 0 | ||
| reportLabel.text = "Running benchmarks..." | ||
|
|
||
| completedLabel.accessibilityIdentifier = "benchmarkCompleted" | ||
| completedLabel.isAccessibilityElement = true | ||
| completedLabel.text = "" | ||
| completedLabel.accessibilityLabel = "" | ||
|
|
||
| jsonLabel.accessibilityIdentifier = "benchmarkReportJSON" | ||
| jsonLabel.isAccessibilityElement = true | ||
| jsonLabel.text = "" | ||
| jsonLabel.accessibilityLabel = "" | ||
| jsonLabel.numberOfLines = 1 | ||
|
|
||
| stack.addArrangedSubview(reportLabel) | ||
| stack.axis = .vertical | ||
| stack.spacing = 8 | ||
| stack.translatesAutoresizingMaskIntoConstraints = false | ||
| view.addSubview(stack) | ||
|
|
||
| NSLayoutConstraint.activate([ | ||
| stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 12), | ||
| stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -12), | ||
| stack.topAnchor.constraint(equalTo: view.topAnchor, constant: 28), | ||
| stack.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor, constant: -12) | ||
| ]) | ||
| } | ||
|
|
||
| override func viewDidAppear(_ animated: Bool) { | ||
| super.viewDidAppear(animated) | ||
| guard !started else { | ||
| return | ||
| } | ||
| started = true | ||
|
|
||
| DispatchQueue.global(qos: .userInitiated).async { | ||
| let options = ProfileLaunchOptions.resolved() | ||
| if options.benchDelayMs > 0 { | ||
| Thread.sleep(forTimeInterval: Double(options.benchDelayMs) / 1_000.0) | ||
| } | ||
|
|
||
| let repeatDeadline = Date().addingTimeInterval( | ||
| Double(options.repeatUntilMs) / 1_000.0 | ||
| ) | ||
| var repeatedRuns = 1 | ||
| var result = BenchRunnerFFI.runCurrentBenchmark() | ||
| while !options.warmupOnly && options.repeatUntilMs > 0 && Date() < repeatDeadline { | ||
| result = BenchRunnerFFI.runCurrentBenchmark() | ||
| repeatedRuns += 1 | ||
| } | ||
|
|
||
| DispatchQueue.main.async { | ||
| self.reportLabel.text = result.displayText | ||
| self.jsonLabel.text = result.jsonReport | ||
| self.jsonLabel.accessibilityLabel = result.jsonReport | ||
| self.completedLabel.text = "completed" | ||
| self.completedLabel.accessibilityLabel = "completed" | ||
| if self.completedLabel.superview == nil { | ||
| self.stack.addArrangedSubview(self.completedLabel) | ||
| self.stack.addArrangedSubview(self.jsonLabel) | ||
| } | ||
| } | ||
|
|
||
| NSLog("BENCH_REPORT_JSON_START") | ||
| NSLog("%@", result.jsonReport) | ||
| NSLog("BENCH_REPORT_JSON_END") | ||
| if repeatedRuns > 1 { | ||
| NSLog("Repeated benchmark %d time(s) during profile capture", repeatedRuns) | ||
| } | ||
|
|
||
| if options.warmupOnly { | ||
| NSLog("Warmup-only profile run complete") | ||
| return | ||
| } | ||
|
|
||
| NSLog("Displaying results for \(options.resultHoldMs) ms for capture output...") | ||
| Thread.sleep(forTimeInterval: Double(options.resultHoldMs) / 1_000.0) | ||
| NSLog("Display hold complete") | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
set -euo pipefailenabled in this step,jq ... | head -1can fail the script whenheadexits after the first match andjqreceives SIGPIPE while still writing, which aborts sticky-comment handling instead of falling back to the warning paths. This is most likely when multiple marker-matching comments exist or the response is large; selecting the first ID insidejqavoids the pipeline failure mode.Useful? React with 👍 / 👎.