Profiling reveals performance issues and informs you about where your application spends most of its time. Once you have identified bottlenecks, you then focus your efforts on investigating those parts and improve them.
For a quick profiling, you can use the
perftools-lite tool, a simplified and
easy-to-use version of CrayPat that provides basic performance analysis
information automatically, with minimum user interaction.
Sampling consist in taking regular snapshots of the applications call stack to create a statistical profile. That's a good option for low overhead profiling.
Tracing revolves around specific program events like entering or exiting a function. This allows the collection of accurate information about specific areas of the code every time the event occurs.