Profiling Arduino Code

The "best way" differs by application. Usually, when this question surfaces, it is to troubleshoot a more identifiable problem. Generally, as AWOL said, toggling a pin state on an oscilloscope reveals things serial print may not. Proofreading one's code may solve the problem.

If this is a general question, not related to a specific problem, you have 3 good first steps.

If you have a specific problem, I would suggest you explain that here, as it may lead to more targeted answers.