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

Side by Side Diff: third_party/WebKit/PerformanceTests/TestData/simple-blob-measure-async.html

Issue 2864643002: Support tracing metrics for measureValueAsync method (Closed)
Patch Set: Address Wang Xianzhu's comment Created 3 years, 7 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src = "../resources/runner.js"></script>
5 <script>
6
7 var startTime;
8 var isDone = false;
9
10 function createAndRead(size) {
11 var reader = new FileReader();
12 var blob = new Blob([new Uint8Array(size)], {type: 'application/octet-string '});
13 reader.onloadend = function(e) {
14 if (reader.error) {
15 throw new Error('Error when reading blob: ' + reader.error);
16 }
17 if (reader.result.byteLength != size)
18 throw new Error("Sizes don't match");
19 PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
20 PerfTestRunner.addRunTestEndMarker();
21 if (!isDone)
22 createAndRead(size);
23 }
24 PerfTestRunner.addRunTestStartMarker();
25 startTime = PerfTestRunner.now();
26 reader.readAsArrayBuffer(blob);
27 }
28
29 function runTest() {
30 createAndRead(1024*1024);
31 }
32
33 window.onload = function () {
34 PerfTestRunner.startMeasureValuesAsync({
35 unit: 'ms',
36 done: function () {
37 isDone = true;
38 },
39 run: function() {
40 runTest();
41 },
42 warmUpCount: 2,
43 iterationCount: 6,
44 description: "Measures performance of blob read.",
45 tracingCategories: 'Blob',
46 traceEventsToMeasure: ['BlobRequest', 'BlobRequest::ReadRawData']
47 });
48 };
49 </script>
50 </body>
51 </html>
52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698