Move math into clock-based periodic update (broken)

Probably a bunch of other changes, but I forgot to push them separately.
Refactor tracefile tools

These may be committed somewhere else, but I found them loose on this
branch, so I am committing them here.
Partially fixed; ignoring v-slope during math interval

This makes things more sane, but still does not predict ticks
accurately.  Plot like this:

   gnuplot --persist -e "plot 'exponential-v20000.trace'
      u 2:3 with lines t 'Velocity',
   '' u 2:4 with lines t 'Position (ideal)',
   '' u 2:(floor(\$4+0.5)) with steps t 'Position (ideal int)',
   '' u 2:5 with steps t 'Position (actual)'"

Notice the steps are sometimes long and sometimes short.  Bad predictions?