Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2080)

Unified Diff: Tools/GardeningServer/model/test/manual/ct-failures-perf.html

Issue 554833003: Add a manual test of the speed of parsing a giant alerts file. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Handle exceptions and update to include trooper alerts. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/GardeningServer/model/test/manual/ct-failures-perf.html
diff --git a/Tools/GardeningServer/model/test/manual/ct-failures-perf.html b/Tools/GardeningServer/model/test/manual/ct-failures-perf.html
new file mode 100644
index 0000000000000000000000000000000000000000..6f82024e0efefc7fbf75469ccc473ed4c72a4564
--- /dev/null
+++ b/Tools/GardeningServer/model/test/manual/ct-failures-perf.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../bower_components/platform/platform.js"></script>
+<link rel="import" href="../../../bower_components/polymer/polymer.html">
+<link rel="import" href="../../ct-commit-log-mock.html">
+<link rel="import" href="../../ct-failures.html">
+</head>
+<body>
+<label><input type="checkbox" id="collect" checked> Collect timing</label> (this checkbox takes a long time to register clicks.)
+<p>Times in ms:
+<ul>
+ <template id="report" repeat="{{results}}">
+ <li>{{time}}</li>
+ </template>
+</ul>
+<script>
+(function() {
+'use strict';
+
+var model = {results: []};
+document.querySelector('#report').model = model;
+
+var analyzer = new CTFailures(CTCommitLogMock());
+var big_alerts = net.json('big-alerts.json');
+net.json = function(url) {
+ if (url === 'http://sheriff-o-matic.appspot.com/alerts') {
+ return big_alerts;
+ } else if (url === 'http://trooper-o-matic.appspot.com/alerts') {
+ return Promise.resolve({});
+ } else {
+ return Promise.reject(new Error('Unexpected URL: ' + url));
+ }
+};
+
+function requestAnimationFramePromise() {
+ return new Promise(function(resolve, reject) {
+ requestAnimationFrame(resolve);
+ });
+}
+
+function waitForCollecting() {
+ var checkbox = document.querySelector('#collect');
+ if (checkbox.checked) {
+ return Promise.resolve();
+ } else {
+ return new Promise(function(resolve, reject) {
+ function resumeCollecting(e) {
+ if (checkbox.checked) {
+ checkbox.removeEventListener(resumeCollecting);
+ resolve();
+ }
+ }
+ checkbox.addEventListener('change', resumeCollecting);
+ });
+ }
+}
+
+// A Promise version of "while(true) iteration()".
+function forever(iteration) {
+ function loop() {
+ iteration().then(loop, function(e) { console.error(e, e.stack); });
Jeffrey Yasskin 2014/09/08 22:43:52 Now with more debuggability.
+ }
+ loop();
+}
+
+big_alerts.then(function() {
+ forever(function() {
+ var start = window.performance.now();
+ return analyzer.update().then(function() {
+ var end = window.performance.now();
+ model.results.push({time: end - start});
+ // Let the browser paint the result, and stop timing when the tab is hidden
+ // or the checkbox is unchecked.
+ return waitForCollecting().then(requestAnimationFramePromise);
+ })
+ });
+});
+
+})();
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698