feature: Add profiling documentation for backends based on BackendUtil.

This commit is contained in:
Tera << 8 2025-01-10 16:23:26 -05:00
parent 356cfb8dca
commit 0efda4b283
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
4 changed files with 112 additions and 1 deletions

6
docs/profiling.md Normal file
View file

@ -0,0 +1,6 @@
# Profiling
To profile any backend code based on `backendutil`, follow these steps:
1. Rebuild the backend with the `debug` flag: `cd $BACKEND_HERE; GOOS=linux go build -tags debug .; cd ..`
2. Copy the binary to the target machine (if applicable), and stop the API server.
3. If you want to profile the CPU utilization, write `cpu` to the file `/tmp/hermes.backendlauncher.profilebackends`: `echo -n "cpu" > /tmp/hermes.backendlauncher.profilebackends`. Else, replace `cpu` with `mem`.
4. Start the API server, with development mode and debug logging enabled.