summaryrefslogtreecommitdiffstats
path: root/gfx/wr/wrench/script/benchmark_server.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/wr/wrench/script/benchmark_server.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/wrench/script/benchmark_server.py')
-rw-r--r--gfx/wr/wrench/script/benchmark_server.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/gfx/wr/wrench/script/benchmark_server.py b/gfx/wr/wrench/script/benchmark_server.py
new file mode 100644
index 0000000000..cb40388130
--- /dev/null
+++ b/gfx/wr/wrench/script/benchmark_server.py
@@ -0,0 +1,59 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function
+import json
+import os
+import subprocess
+import time
+import urllib2
+
+FILE = 'perf.json'
+URL = 'https://wrperf.org/submit'
+
+while True:
+ try:
+ # Remove any previous results
+ try:
+ os.remove(FILE)
+ except Exception:
+ pass
+
+ # Pull latest code
+ subprocess.call(["git", "pull"])
+
+ # Get the git revision of this build
+ revision = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
+
+ # Build
+ subprocess.call(["cargo", "build", "--release"])
+
+ # Run benchmarks
+ env = os.environ.copy()
+ # Ensure that vsync is disabled, to get meaningful 'composite' times.
+ env['vblank_mode'] = '0'
+ subprocess.call(["cargo", "run", "--release", "--", "perf", FILE], env=env)
+
+ # Read the results
+ with open(FILE) as file:
+ results = json.load(file)
+
+ # Post the results to server
+ payload = {
+ 'key': env['WEBRENDER_PERF_KEY'],
+ 'revision': revision,
+ 'timestamp': str(time.time()),
+ 'tests': results['tests'],
+ }
+
+ req = urllib2.Request(URL,
+ headers={"Content-Type": "application/json"},
+ data=json.dumps(payload))
+
+ f = urllib2.urlopen(req)
+ except Exception as e:
+ print(e)
+
+ # Delay a bit until next benchmark
+ time.sleep(60 * 60)