How do i determine FPS?

Any idea how i would implement a FPS counter?

How about:


function draw()
    background(0)
    local fps = 1/DeltaTime
    fill(255)
    text(string.format("FPS: %d", fps), 50, 50)
end

Thanks!