/* * Timing function */ float timing(int N) { int i, msec; long tic1, toc1, tic2, toc2, loop, fn; float time,a=1.; reset_system_time(); /* Reset time to start */ tic1 = mseconds(); /* Get time at start */ for (i=0; i<=N; i++) ; toc1 = mseconds(); /* Get time at end of empty loop */ loop = toc1-tic1; tic2 = mseconds(); /* Get time at start of function loop */ for (i=0; i<=N; i++) { (code to be timed goes here); /* Function to be tested */ } toc2 = mseconds(); /* Get time at end of function loop */ fn = toc2-tic2-loop; /* Time of function loop in msec */ msec = (int)fn; time = (float)msec/(float)N; printf("Fn time =%f msec\n", time); return(time); }