I am attempting a somewhat long calculation and would like to get timing statistics on each calculation that is performed within a loop. My current implementation, which is not working, looks like this:
T = AbsoluteTime[];
t = AbsoluteTime[];
fname = "...\\output.tsv";
Put[ fname ];
For[ i = 1, i < maximum, i++,
(* Calculations that are very time consuming matrix operations *)
t = AbsoluteTime[] - t;
Print[t];
PutAppend[ t , fname];
];
T = AbsoluteTime[] - T;
Print[T];
The output in Mathematica looks like (first t values, then T): "0.019978 0.020020 ....
309.0389375"
The output to the file looks like: 0.0199729.94155819549696 0.020020
7.38343434343434
There are two problems: First, the t values are not accurate. They are at least an order of magnitude smaller than expected. Second, the outputs to the .tsv file don't match the values output within the Mathematica notebook; the sum of the t's isn't equal to T.
Thanks!