mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-23 03:05:32 +02:00
perf(term): add benchmarks
Adds benchmarks by running [alacritty/vtebench](https://github.com/alacritty/vtebench) benchmarks in the terminal. Uses code based on [godotengine/godot-benchmarks](https://github.com/godotengine/godot-benchmarks) to measure average GPU and CPU time spent per frame. Uses [github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) for continuous integration, and publishes benchmark results to https://lihop.github.io/godot-xterm/dev/bench/.
This commit is contained in:
parent
8b33818751
commit
23695a0871
10 changed files with 326 additions and 0 deletions
31
benchmark/terminal_benchmark.gd
Normal file
31
benchmark/terminal_benchmark.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends "res://examples/terminal/terminal.gd"
|
||||
|
||||
signal started
|
||||
signal exited(exit_code: int)
|
||||
|
||||
var vtebench_dir := ProjectSettings.globalize_path("res://benchmark/vtebench")
|
||||
|
||||
|
||||
func _ready():
|
||||
pty.connect("exited", self._on_exit)
|
||||
|
||||
|
||||
func run_benchmark(benchmark):
|
||||
pty.fork(
|
||||
"cargo",
|
||||
["run", "--", "-b", "benchmarks/%s" % benchmark, "--dat", "../results/%s.dat" % benchmark],
|
||||
vtebench_dir,
|
||||
87,
|
||||
29
|
||||
)
|
||||
|
||||
|
||||
func _on_exit(exit_code, _signal):
|
||||
exited.emit(exit_code)
|
||||
|
||||
|
||||
func _on_pty_data_received(data: PackedByteArray):
|
||||
# Listen for the reset sequence (\x1bc), to determine that the benchmark has started.
|
||||
if data.slice(0, 2) == PackedByteArray([27, 99]):
|
||||
$PTY.disconnect("data_received", _on_pty_data_received)
|
||||
started.emit()
|
Loading…
Add table
Add a link
Reference in a new issue