mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
app: make CPU timings more useful
Record the time for generating a frame and submitting it as well as the time for issuing the frame to the GPU and swapping buffers. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -291,6 +291,7 @@ func (g *GPU) renderLoop(glctx gl.Context) error {
|
||||
g.refreshErr <- glctx.MakeCurrent()
|
||||
case frame := <-g.frames:
|
||||
glctx.Lock()
|
||||
frameStart := time.Now()
|
||||
if frame.collectStats && timers == nil && ctx.caps.EXT_disjoint_timer_query {
|
||||
timers = newTimers(ctx)
|
||||
zopsTimer = timers.newTimer()
|
||||
@@ -348,8 +349,9 @@ func (g *GPU) renderLoop(glctx gl.Context) error {
|
||||
ft := zt + st + covt + cleant
|
||||
q := 100 * time.Microsecond
|
||||
zt, st, covt = zt.Round(q), st.Round(q), covt.Round(q)
|
||||
frameDur := time.Since(frameStart).Round(q)
|
||||
ft = ft.Round(q)
|
||||
res.summary = fmt.Sprintf("f:%7s zt:%7s st:%7s cov:%7s", ft, zt, st, covt)
|
||||
res.summary = fmt.Sprintf("draw:%7s gpu:%7s zt:%7s st:%7s cov:%7s", frameDur, ft, zt, st, covt)
|
||||
}
|
||||
res.err = err
|
||||
glctx.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user