Sobes.tech
Intern — Junior

What data can be obtained through the process of profiling an application or system?

sobes.tech AI

Answer from AI

Application or system profiling provides the following data:

  • CPU usage — which functions or methods take the most CPU time.
  • Memory usage — how much memory is allocated and where leaks occur.
  • Execution time of individual operations or functions.
  • Number of function calls and their distribution.
  • Information about locks and thread contention.

In Go, the pprof package is often used for profiling, which allows collecting and analyzing this data.

Example of starting CPU profiling in Go:

import (
    "net/http"
    _ "net/http/pprof"
)

func main() {
    go func() {
        log.Println(http.ListenAndServe("localhost:6060", nil))
    }()
    // main program logic
}

Then, you can connect to http://localhost:6060/debug/pprof/ for analysis.