sclass FPSCounter { new Timestamp started; double counter; synchronized void inc() { counter++; } synchronized double get() { ret doubleRatio(counter, secondsSinceStart()); } synchronized bool isEmpty() { ret counter == 0; } double secondsSinceStart() { ret elapsedSeconds(started); } synchronized void reset { started = tsNow(); counter = 0; } }