Run a command and record its profile into perf.data

perf

sudo perf record {{command}}

click the source code to copy install perf on any operating system with command-not-found.com