In software engineering, when we profile our code, we dynamically analyse it (i.e., at runtime) by gathering metrics and inferring results from these metrics. For instance, one key use of profiling is to identify which parts of our program consume a large amount of CPU time, so that we can optimise and improve it’s performance.
Why even do this? So that we identify where the best place is to spend our time optimising.
Profiling can take a wide range of analytics, including time metrics (runtime, latency), space (memory usage, bandwidth), code metrics (loop/recursion depth), and hardware metrics (cache hits/misses, number of interrupts).1