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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../bower_components/platform/platform.js"></script>
5 <link rel="import" href="../../../bower_components/polymer/polymer.html">
6 <link rel="import" href="../../ct-commit-log-mock.html">
7 <link rel="import" href="../../ct-failures.html">
8 </head>
9 <body>
10 <label><input type="checkbox" id="collect" checked> Collect timing</label> (this checkbox takes a long time to register clicks.)
11 <p>Times in ms:
12 <ul>
13 <template id="report" repeat="{{results}}">
14 <li>{{time}}</li>
15 </template>
16 </ul>
17 <script>
18 (function() {
19 'use strict';
20
21 var model = {results: []};
22 document.querySelector('#report').model = model;
23
24 var analyzer = new CTFailures(CTCommitLogMock());
25 var big_alerts = net.json('big-alerts.json');
26 net.json = function(url) {
27 if (url === 'http://sheriff-o-matic.appspot.com/alerts') {
28 return big_alerts;
29 } else if (url === 'http://trooper-o-matic.appspot.com/alerts') {
30 return Promise.resolve({});
31 } else {
32 return Promise.reject(new Error('Unexpected URL: ' + url));
33 }
34 };
35
36 function requestAnimationFramePromise() {
37 return new Promise(function(resolve, reject) {
38 requestAnimationFrame(resolve);
39 });
40 }
41
42 function waitForCollecting() {
43 var checkbox = document.querySelector('#collect');
44 if (checkbox.checked) {
45 return Promise.resolve();
46 } else {
47 return new Promise(function(resolve, reject) {
48 function resumeCollecting(e) {
49 if (checkbox.checked) {
50 checkbox.removeEventListener(resumeCollecting);
51 resolve();
52 }
53 }
54 checkbox.addEventListener('change', resumeCollecting);
55 });
56 }
57 }
58
59 // A Promise version of "while(true) iteration()".
60 function forever(iteration) {
61 function loop() {
62 iteration().then(loop, function(e) { console.error(e, e.stack); });
Jeffrey Yasskin 2014/09/08 22:43:52 Now with more debuggability.
63 }
64 loop();
65 }
66
67 big_alerts.then(function() {
68 forever(function() {
69 var start = window.performance.now();
70 return analyzer.update().then(function() {
71 var end = window.performance.now();
72 model.results.push({time: end - start});
73 // Let the browser paint the result, and stop timing when the tab is hidd en
74 // or the checkbox is unchecked.
75 return waitForCollecting().then(requestAnimationFramePromise);
76 })
77 });
78 });
79
80 })();
81 </script>
82 </body>
83 </html>
OLDNEW
« 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