you can set trace points at the start/end line of code that you want to trace.
then in Software Analysis window trace data viewer you will see the information shows that trace starts collecting from the address, where you set start tracepoint, and trace collection stops before the address where you set stop
tracepoint.
for more details, see Profiling and Analysis Users Guide.pdf , Chapter 7. Setting Tracepoints
------------------------------------------------
this answer is for you. if it answers your question, please click on the "correct answer" button.
Best Regards,
JunZhang