Stopwatch interval timer

For debugging performance in Chrome we wrote a high-res stopwatch API.
 Specifically, we needed to measure sub-millisecond times.  Currently there
is no mechanism for a javascript application to access fine-grained timers.
Is there any interest in standardizing something like this?
Here is the basic API we're using.  We are not wed to this API, but we like
it because it is functional, minimalist, and easy to use.  Feedback welcome.

function Interval() {
  // Starts the interval timer
  // If already started, restarts the start time.
  this.start = function() {}

  // Stops the interval timer.
  // If the timer has not been started, has no effect
  // If the timer has already been stopped, resets the stop time to now.
  this.stop = function() {}

  // Get the measured interval in microseconds.
  // If the timer was started, but not stopped, gets the time since it was
  // Otherwise returns the difference between the stop and start times.
  this.microseconds = function() {}


Mike Belshe

Received on Thursday, 26 February 2009 07:39:58 UTC