lovr.graphics.tick

Starts a named timer on the GPU, which can be stopped using lovr.graphics.tock.

lovr.graphics.tick(label)

Arguments

NameTypeDescription
labelstringThe name of the timer.

Returns

Nothing

Notes

The timer can be stopped by calling lovr.graphics.tock using the same name. All drawing commands between the tick and the tock will be timed. It is not possible to nest calls to tick and tock.

GPU timers are not supported on all systems. Check the timers feature using lovr.graphics.getFeatures to see if it is supported on the current system.

Example

function lovr.draw()
  lovr.graphics.tick('tim')

  -- Draw a bunch of cubes
  for x = -4, 4 do
    for y = -4, 4 do
      for z = -4, 4 do
        lovr.graphics.cube('fill', x, y, z, .2)
      end
    end
  end

  print('it took ' .. (lovr.graphics.tock('tim') or 0) .. ' seconds')
end

See also