Categories
Performance Utilities and Tools

Measure the time of program execution

The time command in Linux is used to determine the duration of execution of a Go binary program. The time command returns, three(3) results are displayed:

  • real time – the total execution time. This is the time elapsed between invocation and termination of the command.
  • user CPU time – the CPU time used by your process.
  • system (sys) CPU time – the CPU time used by the system on behalf of your process.

# time go.binary.program

real 0m0.001s
user 0m1.021s
sys  0m0.000s

Categories
Performance

Profiling Go Code

Profiling is a practice that can be used to measure the resources utilized in a computer system. Profiling is often done to understand the CPU or memory utilization within a program in order to optimize for execution time, size, or reliability.

https://pkg.go.dev/runtime/pprof?tab=doc

Articles of Go Profiling

https://blog.golang.org/pprof

Profiling with go test command

Usage:

go test [build/test flags] [packages] [build/test flags & test binary flags]

Categories
Performance Utilities and Tools

Linux Performance Tools

http://www.brendangregg.com/linuxperf.html

http://brendangregg.com/usemethod.html