In the following code, I called

display.timerExec(MILLISEC_WAIT , this);

at regular interval.

---
The result is like this.

MILLISEC_WAIT = 10 -> fps ~ 63
MILLISEC_WAIT = 20 -> fps ~ 32
MILLISEC_WAIT = 50 -> fps ~ 16
MILLISEC_WAIT = 100 -> fps ~ 9
---

I expected that fps is approximately equal to [1000/MILLSEC_WAIT].
But the result is much worse than that. (especially MILLSEC_WAIT = 10, 20, 50)

It seems timerExec was not called at exact interval that I specified.

Could somebody tell me why this happens?

Regards,

Java Code:
public class SWTExample {
	static final int MILLISEC_WAIT = 100;

	static int fps;
	static long lastFPS;
	static Shell shell;

	public static void main(String[] args){
		final Display display = new Display();
		shell = new Shell(display);
		shell.open();

		lastFPS = System.currentTimeMillis();

		display.asyncExec(new Runnable(){
			@Override
			public void run() {
				if(!shell.isDisposed()){
					// I would like to use OpenGL rendering here...
					updateFps();
					display.timerExec(MILLISEC_WAIT, this);
				}
			}
		});

		while(!shell.isDisposed()){
			if(!display.readAndDispatch()){
				display.sleep();
			}
		}
		display.dispose();
	}

	private static void updateFps(){
		if(System.currentTimeMillis() - lastFPS > 1000){
			shell.setText("FPS: "+fps);
			fps = 0;
			lastFPS += 1000;
		}
		fps++;
	}
}