timing code and simple example