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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/PerformanceTests/TestData/simple-blob-measure-async.html
diff --git a/third_party/WebKit/PerformanceTests/TestData/simple-blob-measure-async.html b/third_party/WebKit/PerformanceTests/TestData/simple-blob-measure-async.html
new file mode 100644
index 0000000000000000000000000000000000000000..52a7cc1b891c5b593c9a021d25cce7051f4f0bd1
--- /dev/null
+++ b/third_party/WebKit/PerformanceTests/TestData/simple-blob-measure-async.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src = "../resources/runner.js"></script>
+<script>
+
+var startTime;
+var isDone = false;
+
+function createAndRead(size) {
+ var reader = new FileReader();
+ var blob = new Blob([new Uint8Array(size)], {type: 'application/octet-string'});
+ reader.onloadend = function(e) {
+ if (reader.error) {
+ throw new Error('Error when reading blob: ' + reader.error);
+ }
+ if (reader.result.byteLength != size)
+ throw new Error("Sizes don't match");
+ PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
+ PerfTestRunner.addRunTestEndMarker();
+ if (!isDone)
+ createAndRead(size);
+ }
+ PerfTestRunner.addRunTestStartMarker();
+ startTime = PerfTestRunner.now();
+ reader.readAsArrayBuffer(blob);
+}
+
+function runTest() {
+ createAndRead(1024*1024);
+}
+
+window.onload = function () {
+ PerfTestRunner.startMeasureValuesAsync({
+ unit: 'ms',
+ done: function () {
+ isDone = true;
+ },
+ run: function() {
+ runTest();
+ },
+ warmUpCount: 2,
+ iterationCount: 6,
+ description: "Measures performance of blob read.",
+ tracingCategories: 'Blob',
+ traceEventsToMeasure: ['BlobRequest', 'BlobRequest::ReadRawData']
+ });
+};
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698