Set numOfSamples at track end, add tracing

Set numOfSamples at track end, add tracing