Add debugging.md

This commit is contained in:
Alex Gleason 2023-10-05 21:01:13 -05:00
parent f611a94144
commit e4f1f0dc53
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 17 additions and 0 deletions

17
docs/debugging.md Normal file
View File

@ -0,0 +1,17 @@
# Debugging Ditto
Running the command `deno task debug` will start the Ditto server in debug mode, making it possible to inspect with Chromium-based browsers by visiting `chrome://inspect`.
From there, go to the "Performance" tab and click "Start profiling". Perform the actions you want to profile, then click "Stop profiling". You can then inspect the call stack and see where the time is being spent.
## Remote debugging
If the Ditto server is on a separate machine, you will first need to put it into debug mode. Edit its systemd file (usually located at `/etc/systemd/system/ditto.service`) and change `deno task start` to `deno task debug` in the `ExecStart` line. Then run `systemctl daemon-reload` and `systemctl restart ditto`.
To access the debugger remotely, you can use SSH port forwarding. Run this command on your local machine, replacing `<user>@<host>` with the SSH login for the remote machine:
```sh
ssh -L 9229:localhost:9229 <user>@<host>
```
Then, in Chromium, go to `chrome://inspect` and the Ditto server should be available.