io/profile: [API] delete package

It was a design mistake to make profiling data available to programs.
Rather, profiling should either be a user-configurable debug overlay,
reported through runtime/trace, or both.

This change drops the io/profile package because we're about to overhaul
event routing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-10-07 19:12:18 -05:00
parent e19a248815
commit 3648bdc02a
6 changed files with 7 additions and 107 deletions
+2 -14
View File
@@ -21,7 +21,6 @@ import (
"gioui.org/io/event"
"gioui.org/io/key"
"gioui.org/io/pointer"
"gioui.org/io/profile"
"gioui.org/io/router"
"gioui.org/io/system"
"gioui.org/layout"
@@ -308,7 +307,7 @@ func (w *Window) frame(frame *op.Ops, viewport image.Point) error {
return w.gpu.Frame(frame, target, viewport)
}
func (w *Window) processFrame(d driver, frameStart time.Time) {
func (w *Window) processFrame(d driver) {
for k := range w.semantic.ids {
delete(w.semantic.ids, k)
}
@@ -336,13 +335,6 @@ func (w *Window) processFrame(d driver, frameStart time.Time) {
w.imeState = newState
d.EditorStateChanged(oldState, newState)
}
if q.Profiling() && w.gpu != nil {
frameDur := time.Since(frameStart)
frameDur = frameDur.Truncate(100 * time.Microsecond)
quantum := 100 * time.Microsecond
timings := fmt.Sprintf("tot:%7s %s", frameDur.Round(quantum), w.gpu.Profile())
q.Queue(profile.Event{Timings: timings})
}
if t, ok := q.WakeupTime(); ok {
w.setNextFrame(t)
}
@@ -844,10 +836,6 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
break
}
w.metric = e2.Metric
var frameStart time.Time
if w.queue.q.Profiling() {
frameStart = time.Now()
}
w.hasNextFrame = false
e2.Frame = w.update
e2.Queue = &w.queue
@@ -891,7 +879,7 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
close(w.destroy)
break
}
w.processFrame(d, frameStart)
w.processFrame(d)
w.updateCursor(d)
case system.DestroyEvent:
w.destroyGPU()