var %start.time $ticksqpc
do stuff
echo -s debug line $scriptline ticks: $calc($ticksqpc - %start.time)

Note that echoing to screen can affect how long something takes, so don't do it inside the loop. You can also save them all up to show them at the same time:

var %start.time $ticksqpc , %msg $null
do stuff
var %msg %msg line $scriptline ticks: $calc($ticksqpc - %start.time)
do stuff
var %msg %msg line $scriptline ticks: $calc($ticksqpc - %start.time)
echo -s debug %msg