71 lines
2.1 KiB
Markdown
71 lines
2.1 KiB
Markdown
# TelemetryMockserver
|
|
Utility to both record and replay telemetry data from multiple simulators.
|
|
|
|
This will help me develop some stuff I'm doing for `ESDI` and my peripherals
|
|
without having to be playing the game while doing it (fans are noisy).
|
|
|
|
|
|
## Related projects
|
|
- [ESDI](https://github.com/ESilva15/ESDI)
|
|
- [iRacing Go SDK](https://github.com/ESilva15/goirsdk)
|
|
- [BeamNG Go SDK](https://github.com/ESilva15/gobngsdk)
|
|
|
|
|
|
# Installation
|
|
`go install github.com/ESilva15/TelemetryMockserver@latest`
|
|
|
|
|
|
# Usage
|
|
To start replaying (BeamNG as an example):
|
|
`telemetrymockserver beamng replay [--loop] -a 127.0.0.1 -p 4443 -i sunburstManual.bin`
|
|
- `loop` allows the replay functionality to keep replaying the same data file
|
|
|
|
|
|
To start recording (BeamNG as an example):
|
|
`TelemetryMockserver beamng record -a 127.0.0.1 -p 4443 -o sunburstDCT.bin`
|
|
|
|
## Development
|
|
Use `tcpdump` to listen to the socket and check if data is coming through:
|
|
`tcpdump -i any udp port <port> -X`
|
|
|
|
### TODO:
|
|
- [ ] Create the auto completion file and add it to `$FPATH`
|
|
- [ ] Create a shortcut so we don't have to type out `telemetrymockserver` everytime
|
|
|
|
|
|
### Benchmark
|
|
Run with:
|
|
`go test ./mockserver -bench=BenchmarkReplayAsync -benchmem -benchtime=1x -memprofile=mem.pprof`
|
|
|
|
Analyze the output with:
|
|
`go tool pprof -sample_index=alloc_objects mem.pprof` -> `top`
|
|
- `ignore=net` will ignore the net package for example
|
|
- `focus=mockserver` will show only the results from this code we are testing
|
|
or
|
|
`go tool pprof -http=:8080 mem.pprof`
|
|
|
|
|
|
#### Previous results:
|
|
Note: this were made before introducing the real time visualizer
|
|
```
|
|
goos: linux
|
|
goarch: amd64
|
|
pkg: github.com/ESilva15/BeamNGMockOg/mockserver
|
|
cpu: AMD Ryzen 5 5600G with Radeon Graphics
|
|
BenchmarkReplayAsync-12 1 109433931841 ns/op 356088 B/op 13272 allocs/op
|
|
PASS
|
|
ok github.com/ESilva15/BeamNGMockOg/mockserver 109.440s
|
|
```
|
|
|
|
|
|
#### Current results
|
|
```
|
|
goos: linux
|
|
goarch: amd64
|
|
pkg: github.com/ESilva15/BeamNGMockOg/mockserver
|
|
cpu: AMD Ryzen 7 5800X3D 8-Core Processor
|
|
BenchmarkReplayAsync-16 1 109433890158 ns/op 1673128 B/op 112986 allocs/op
|
|
PASS
|
|
ok github.com/ESilva15/BeamNGMockOg/mockserver 109.439s
|
|
```
|