mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-10 04:40:25 +01:00
9569c9e489
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/.
31 lines
733 B
GDScript
31 lines
733 B
GDScript
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()
|