Commit 84cded1d authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

[WebSocket] Make arraybuffer test flexible about iteration and server address.

This patch changes the test to listen |searchParams| option so that
we can test it in various size from lightweight-for-check to heavyweight-for-accuracy.

Example:
$ content_shell receive-arraybuffer-1MBx100.html?iteration=3&server=ws://127.0.0.1:8002/
>
Connect to ws://127.0.0.1:8002/
Running 3 times
Ignoring warm-up run (346.07608397871 MB/s)
349.01482119459 MB/s
332.869505903946 MB/s
286.404642021716 MB/s
Description: Measure performance of receiving 1MB array 100 times.


Bug: 954000
Change-Id: Idc0365c97e6a659f0d91e8e57f6c789407b06739
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1669149
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671995}
parent 0bf2260f
...@@ -11,8 +11,13 @@ ...@@ -11,8 +11,13 @@
// $ npm start // $ npm start
// $ python ../../../../tools/perf/run_benchmark run blink_perf --browser=canary --test-path=websocket\receive-arraybuffer-1MBx100.html // $ python ../../../../tools/perf/run_benchmark run blink_perf --browser=canary --test-path=websocket\receive-arraybuffer-1MBx100.html
const params = (new URL(document.location)).searchParams;
const server = params.get("server") || "ws://127.0.0.1:8001/";
PerfTestRunner.log("Connect to " + server);
const iteration = params.get("iteration") || 6;
async function runTestCase() { async function runTestCase() {
const ws = new WebSocket("ws://127.0.0.1:8001/"); const ws = new WebSocket(server);
ws.binaryType = "arraybuffer"; ws.binaryType = "arraybuffer";
const onOpen = new Promise(resolve => { const onOpen = new Promise(resolve => {
ws.onopen = () => { ws.onopen = () => {
...@@ -42,7 +47,7 @@ PerfTestRunner.startMeasureValuesAsync({ ...@@ -42,7 +47,7 @@ PerfTestRunner.startMeasureValuesAsync({
run: async function() { run: async function() {
while (!isDone) await runTestCase(); while (!isDone) await runTestCase();
}, },
iterationCount: 6, iterationCount: iteration,
}); });
</script> </script>
</body> </body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment