Question on Profiling sample time on arduino atmega328
The sample time is the time between calls of your function, not the time it takes your function to run.  For example:

Loop start:
Analog read or other function calls
PID function call - Time 0
Analog write or PWM write function calls
Loop Restarts...
Analog read....
PID function call - Time 1
Analog write or PWM write...

Your sample time is the difference between Time 1 and Time 0.