From 49ddf5c7ce94318175d9894df943628c3c09944d Mon Sep 17 00:00:00 2001 From: LeandroTreu Date: Mon, 13 May 2024 15:46:24 +0200 Subject: [PATCH] nr mousescripts, plot gpu stats --- mouse_scripts/mousepanning_nr.sh | 32 ++++++++++ mouse_scripts/scroll_nr.sh | 19 ++++++ profile_parser/js/plot_acc_stats.js | 81 ++++++++++++++++++++++++ profile_parser/src/plot_acc_stats.ts | 94 ++++++++++++++++++++++++++++ 4 files changed, 226 insertions(+) create mode 100755 mouse_scripts/mousepanning_nr.sh create mode 100755 mouse_scripts/scroll_nr.sh create mode 100644 profile_parser/js/plot_acc_stats.js create mode 100644 profile_parser/src/plot_acc_stats.ts diff --git a/mouse_scripts/mousepanning_nr.sh b/mouse_scripts/mousepanning_nr.sh new file mode 100755 index 0000000..3b76dde --- /dev/null +++ b/mouse_scripts/mousepanning_nr.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Set these according to screen size and element positions +# Find mouse pointer coordinates with "xdotool getmouselocation" +panning_start_x=1010 +panning_start_y=600 +n_mousemove=20 # Mouse-movements per panning +panning_repetitions=5 + +# Alt+Tab to the browser window +xdotool key Alt+Tab +sleep 0.5 + +xdotool mousemove --sync $panning_start_x $panning_start_y +xdotool mousedown 1 +for ((j = 0; j < panning_repetitions; j++)); do + + for ((i = 0; i < n_mousemove; i++)); do + + sleep 0.025 + xdotool mousemove_relative --sync 0 20 + done + for ((i = 0; i < n_mousemove; i++)); do + + sleep 0.025 + xdotool mousemove_relative --sync -- 0 -20 + done +done +xdotool mouseup 1 + +# Alt+Tab back to the terminal +xdotool key Alt+Tab diff --git a/mouse_scripts/scroll_nr.sh b/mouse_scripts/scroll_nr.sh new file mode 100755 index 0000000..e7fd1b5 --- /dev/null +++ b/mouse_scripts/scroll_nr.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Set these according to screen size and element positions +# Find mouse pointer coordinates with "xdotool getmouselocation" +zoom_x=881 +zoom_y=674 +delay=50 # In ms, between scroll ticks +repetitions=50 + +# Alt+Tab to the browser window +xdotool key Alt+Tab +sleep 0.5 + +# Set zoom mouse position +xdotool mousemove --sync $zoom_x $zoom_y +xdotool click --repeat $repetitions --delay $delay 4 + +# Alt+Tab back to terminal +xdotool key Alt+Tab diff --git a/profile_parser/js/plot_acc_stats.js b/profile_parser/js/plot_acc_stats.js new file mode 100644 index 0000000..7723236 --- /dev/null +++ b/profile_parser/js/plot_acc_stats.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const nodeplotlib_1 = require("nodeplotlib"); +// Scroll +let data = []; +let benchmarks = []; +benchmarks.push({ name: "Un-optimized", values: [25.8, 23.4, 24.0], color: "red" }); +benchmarks.push({ name: "Opt. getImageData", values: [49.8, 51.0, 50.4], color: "orange" }); +benchmarks.push({ name: "Opt. willReadFrequently", values: [52.2, 52.2, 50.4], color: "orange" }); +benchmarks.push({ name: "Opt. GPU default", values: [57.6, 58.2, 58.2], color: "green" }); +benchmarks.push({ name: "Opt. GPU desync", values: [60.0, 60.0, 60.0], color: "green" }); +for (let i = 0; i < benchmarks.length; ++i) { + const benchmark = benchmarks[i]; + let values = benchmark.values; + values.sort((a, b) => a - b); + let y_values = [values[1]]; + let bar = { + x: [benchmark.name], + y: y_values, + type: 'bar', + marker: { + color: benchmark.color, + }, + name: benchmark.name, + // text: y_values.map(String), + // textposition: "auto", + // hoverinfo: "none", + error_y: { + type: 'data', + symmetric: false, + array: [values[2] - values[1]], + arrayminus: [values[1] - values[0]], + visible: true + }, + }; + data.push(bar); +} +let layout = { + title: "Zoom FPS Benchmark", + yaxis: { title: "Average FPS", range: [0, 61], dtick: 5 }, +}; +(0, nodeplotlib_1.plot)(data, layout); +// Panning +data = []; +benchmarks = []; +benchmarks.push({ name: "Un-optimized", values: [17.4, 18.0, 17.4], color: "red" }); +benchmarks.push({ name: "Opt. getImageData", values: [25.2, 27.0, 25.8], color: "orange" }); +benchmarks.push({ name: "Opt. willReadFrequently", values: [27.0, 24.6, 27.0], color: "orange" }); +benchmarks.push({ name: "Opt. GPU default", values: [43.2, 42.0, 43.2], color: "green" }); +benchmarks.push({ name: "Opt. GPU desync", values: [40.8, 42.0, 42.0], color: "green" }); +for (let i = 0; i < benchmarks.length; ++i) { + const benchmark = benchmarks[i]; + let values = benchmark.values; + values.sort((a, b) => a - b); + let y_values = [values[1]]; + let bar = { + x: [benchmark.name], + y: y_values, + type: 'bar', + marker: { + color: benchmark.color, + }, + name: benchmark.name, + // text: y_values.map(String), + // textposition: "auto", + // hoverinfo: "none", + error_y: { + type: 'data', + symmetric: false, + array: [values[2] - values[1]], + arrayminus: [values[1] - values[0]], + visible: true + }, + }; + data.push(bar); +} +layout = { + title: "Panning FPS Benchmark", + yaxis: { title: "Average FPS", range: [0, 61], dtick: 5 }, +}; +(0, nodeplotlib_1.plot)(data, layout); diff --git a/profile_parser/src/plot_acc_stats.ts b/profile_parser/src/plot_acc_stats.ts new file mode 100644 index 0000000..e102fb8 --- /dev/null +++ b/profile_parser/src/plot_acc_stats.ts @@ -0,0 +1,94 @@ +import { plot, Plot } from 'nodeplotlib'; + +// Scroll +let data: Plot[] = []; +let benchmarks: {name: string, values: number[], color: string}[] = []; + +benchmarks.push({name: "Un-optimized", values: [25.8, 23.4, 24.0], color: "red"}); +benchmarks.push({name: "Opt. getImageData", values: [49.8, 51.0, 50.4], color: "orange"}); +benchmarks.push({name: "Opt. willReadFrequently", values: [52.2, 52.2, 50.4], color: "orange"}); +benchmarks.push({name: "Opt. GPU default", values: [57.6, 58.2, 58.2], color: "green"}); +benchmarks.push({name: "Opt. GPU desync", values: [60.0, 60.0, 60.0], color: "green"}); + +for (let i = 0; i < benchmarks.length; ++i) { + + const benchmark = benchmarks[i]; + let values = benchmark.values; + values.sort((a, b) => a - b); + + let y_values = [values[1]]; + let bar: Plot = { + x: [benchmark.name], + y: y_values, + type: 'bar', + marker: { + color: benchmark.color, + }, + name: benchmark.name, + // text: y_values.map(String), + // textposition: "auto", + // hoverinfo: "none", + error_y: { + type: 'data', + symmetric: false, + array: [values[2]-values[1]], + arrayminus: [values[1]-values[0]], + visible: true + }, + }; + data.push(bar); +} + + +let layout = { + title: "Zoom FPS Benchmark", + yaxis: {title: "Average FPS", range: [0, 61], dtick: 5}, +} +plot(data, layout); + + +// Panning +data = []; +benchmarks = []; + +benchmarks.push({name: "Un-optimized", values: [17.4, 18.0, 17.4], color: "red"}); +benchmarks.push({name: "Opt. getImageData", values: [25.2, 27.0, 25.8], color: "orange"}); +benchmarks.push({name: "Opt. willReadFrequently", values: [27.0, 24.6, 27.0], color: "orange"}); +benchmarks.push({name: "Opt. GPU default", values: [43.2, 42.0, 43.2], color: "green"}); +benchmarks.push({name: "Opt. GPU desync", values: [40.8, 42.0, 42.0], color: "green"}); + +for (let i = 0; i < benchmarks.length; ++i) { + + const benchmark = benchmarks[i]; + let values = benchmark.values; + values.sort((a, b) => a - b); + + let y_values = [values[1]]; + let bar: Plot = { + x: [benchmark.name], + y: y_values, + type: 'bar', + marker: { + color: benchmark.color, + }, + name: benchmark.name, + // text: y_values.map(String), + // textposition: "auto", + // hoverinfo: "none", + error_y: { + type: 'data', + symmetric: false, + array: [values[2]-values[1]], + arrayminus: [values[1]-values[0]], + visible: true + }, + }; + data.push(bar); +} + + +layout = { + title: "Panning FPS Benchmark", + yaxis: {title: "Average FPS", range: [0, 61], dtick: 5}, +} +plot(data, layout); \ No newline at end of file