-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Plots: make measure script more flexible (CLI args) #2183
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
2b7da18
update gitignore
wwwillchen 5577cf7
add flags for mobile measurement
wwwillchen 9d11132
top 18 sites
wwwillchen 4655cbe
remove airbnb - not reliable
wwwillchen d38d070
adjust measure.js
wwwillchen a7eaf8e
define SUBSET --subset flag
wwwillchen adb59a9
fixup measure
wwwillchen 57b763e
make screenshot/analyze.js handle missing results
wwwillchen 506dc30
adjustment factors
wwwillchen b8c4577
cherry-picked plot-per-site
wwwillchen ed44705
wrap
wwwillchen 39f6b4c
fix comments
wwwillchen 5338f89
update
wwwillchen d6cabdb
undo emulation.js
wwwillchen 52ef9ef
small improvements
wwwillchen 7f214eb
merge
wwwillchen 72ae90d
fix launcher
wwwillchen 963ec9e
paul irish fb
wwwillchen da6581b
Merge branch 'master' of https://github.com/GoogleChrome/lighthouse i…
wwwillchen 1447442
nit
wwwillchen 922d7ab
fixup measure
wwwillchen f637160
fixup ab-screenshot
wwwillchen 2170a9e
fixups
wwwillchen 3d4c291
make eslint happy
wwwillchen cc59d4d
paul fb
wwwillchen f50a21f
paul fb
wwwillchen 8555129
fixup
wwwillchen e93c300
paul fb
wwwillchen 92a927a
add links
wwwillchen ebdea6e
spruce up readme
wwwillchen 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 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
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,39 @@ | ||
<!-- | ||
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. | ||
--> | ||
|
||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<script src="https://cdn.plot.ly/plotly-1.25.2.min.js"></script> | ||
<style> | ||
nav { display: flex; justify-content: center; font-size: 17px; font-family: "Open Sans", verdana, arial, sans-serif; padding: 5px 0 23px; border-bottom: 1px solid black; } | ||
nav a { padding: 0 5px; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<nav> | ||
View results: | ||
<a href="./index.html">grouped by metric</a> | ||
<a href="./metrics-per-site.html">grouped by site</a> | ||
<a>bar charts per site</a> | ||
</nav> | ||
<script src="./out/generatedResults.js"></script> | ||
<script src="./bars-per-site.js"></script> | ||
</body> | ||
|
||
</html> |
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,86 @@ | ||
/** | ||
* @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'; | ||
|
||
/* global Plotly, generatedResults */ | ||
/* eslint-env browser */ | ||
|
||
const IGNORED_METRICS = new Set(['Navigation Start']); | ||
|
||
const metrics = Object.keys(generatedResults).filter(metric => !IGNORED_METRICS.has(metric)); | ||
|
||
let elementId = 1; | ||
|
||
/** | ||
* Incrementally renders the plot, otherwise it hangs the browser | ||
* because it's generating so many charts. | ||
*/ | ||
const queuedPlots = []; | ||
|
||
function enqueuePlot(fn) { | ||
const isFirst = queuedPlots.length == 0; | ||
queuedPlots.push(fn); | ||
if (isFirst) { | ||
renderPlots(); | ||
} | ||
} | ||
|
||
function renderPlots() { | ||
window.requestAnimationFrame(_ => { | ||
const plotFn = queuedPlots.shift(); | ||
if (plotFn) { | ||
plotFn(); | ||
renderPlots(); | ||
} | ||
}); | ||
} | ||
|
||
function createChartElement(height = 800) { | ||
const div = document.createElement('div'); | ||
div.style = `width: 100%; height: ${height}px`; | ||
div.id = 'chart' + elementId++; | ||
document.body.appendChild(div); | ||
return div.id; | ||
} | ||
|
||
function generateGroupedBarChart() { | ||
const sitesCount = metrics.reduce( | ||
(acc, metric) => Math.max(acc, generatedResults[metric].length), | ||
0 | ||
); | ||
for (let i = 0; i < sitesCount; i++) { | ||
const data = metrics.map(metric => ({ | ||
y: generatedResults[metric][i].metrics.map(m => m ? m.timing : null), | ||
name: metric, | ||
type: 'bar' | ||
})); | ||
|
||
const layout = { | ||
yaxis: { | ||
rangemode: 'tozero' | ||
}, | ||
hovermode: 'closest', | ||
barmode: 'group', | ||
title: generatedResults[metrics[0]][i].site | ||
}; | ||
enqueuePlot(_ => { | ||
Plotly.newPlot(createChartElement(), data, layout); | ||
}); | ||
} | ||
} | ||
|
||
generateGroupedBarChart(); |
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
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.
you got a whole CLI for measure.js now!. at the very least you should paste the
--help
output into the readme