-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(driver): wait for CPU idle via clientside perfObserver (#2473)
- Loading branch information
1 parent
673c3ba
commit 56eaa50
Showing
6 changed files
with
187 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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,23 @@ | ||
<html> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | ||
<body> | ||
Just try and figure out my TTCI (hint: it should be ~10s) | ||
|
||
<script> | ||
/** | ||
* Stalls the main thread for timeInMs | ||
*/ | ||
function stall(timeInMs) { | ||
const start = performance.now(); | ||
while (performance.now() - start < timeInMs) { | ||
for (let i = 0; i < 1000000; i++) ; | ||
} | ||
} | ||
|
||
setTimeout(() => stall(250), 1000); // stall for 250ms, 1 second out | ||
setTimeout(() => stall(500), 2000); // stall for 500ms, 2 seconds out | ||
setTimeout(() => stall(5000), 5000); // stall for 5000ms, 5 seconds out | ||
</script> | ||
<script src="bogus.js?delay=2000"></script> | ||
</body> | ||
</html> |
26 changes: 26 additions & 0 deletions
26
lighthouse-cli/test/smokehouse/tricky-ttci/expectations.js
This file contains 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,26 @@ | ||
/** | ||
* @license Copyright 2017 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* Expected Lighthouse audit values for --perf tests | ||
*/ | ||
module.exports = [ | ||
{ | ||
initialUrl: 'http://localhost:10200/tricky-ttci.html', | ||
url: 'http://localhost:10200/tricky-ttci.html', | ||
audits: { | ||
'first-interactive': { | ||
score: '<75', | ||
rawValue: '>9000', | ||
}, | ||
'consistently-interactive': { | ||
score: '<75', | ||
rawValue: '>9000', | ||
}, | ||
} | ||
}, | ||
]; |
This file contains 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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
node lighthouse-cli/test/fixtures/static-server.js & | ||
|
||
sleep 0.5s | ||
|
||
config="lighthouse-core/config/perf.json" | ||
expectations="lighthouse-cli/test/smokehouse/tricky-ttci/expectations.js" | ||
|
||
yarn smokehouse -- --config-path=$config --expectations-path=$expectations | ||
exit_code=$? | ||
|
||
# kill test servers | ||
kill $(jobs -p) | ||
|
||
exit "$exit_code" |
This file contains 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 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 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