Tic and Toc are the functions being usually used because they provide better resolution, which is important for timing small calculations.
In order to get around the problem of variance in system resource usage by other processes, you can run the computation being profiled a large enough number of times so that averaging the results will smooth out the noise.
if the calculation is very small, you can run it in a loop between each pair of tic and toc calls. The size of this inner loop can be determined experimentally by specifying a desired runtime of the tic-toc pair and increasing the inner loop size until it is achieved.