mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-22 05:29:44 +02:00
add profiling guide to contributor docs
This commit is contained in:
parent
d22f6d73ff
commit
ffe5e16688
@ -132,6 +132,34 @@ If you want to trigger a debug session from VSCode, you can use the following sn
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Profiling
|
||||||
|
|
||||||
|
If you want to investigate what's contributing to CPU usage you can add the following to the top of the `main()` function in `main.go`
|
||||||
|
|
||||||
|
```go
|
||||||
|
import "runtime/pprof"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
f, err := os.Create("cpu.prof")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("could not create CPU profile: ", err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
if err := pprof.StartCPUProfile(f); err != nil {
|
||||||
|
log.Fatal("could not start CPU profile: ", err)
|
||||||
|
}
|
||||||
|
defer pprof.StopCPUProfile()
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run lazygit, and afterwards, from your terminal, run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go tool pprof --web cpu.prof
|
||||||
|
```
|
||||||
|
|
||||||
|
That should open an application which allows you to view the breakdown of CPU usage.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Lazygit has two kinds of tests: unit tests and integration tests. Unit tests go in files that end in `_test.go`, and are written in Go. For integration tests, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
|
Lazygit has two kinds of tests: unit tests and integration tests. Unit tests go in files that end in `_test.go`, and are written in Go. For integration tests, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user