This UDF is embedded in our Universal Login Script... we make between 50 and 80 calls to it depending on the number of objects we're processing.
Two caveats.. the accuracy is about +/- 8ms. I think that's got something to do with how Kix processes the timer. In testing in our ULS, I find that it adds a minimal amount of overhead to the script. Depending on the size of the script and where the "Kix timing cycle" is when the script starts, the difference is 0-16 ms when timestamping is enabled.
Also - I write the $PERFLOG value to a file AFTER tha last TimeStamp() call so the performance logging isn't included in the script performance. If I were to hazard a guess, it takes longer to write the PerfLog data than to collect it!
Glenn
_________________________
Actually I
am a Rocket Scientist!