profile.go raw

   1  // SPDX-License-Identifier: Unlicense OR MIT
   2  
   3  // Package profiles provides access to rendering
   4  // profiles.
   5  package profile
   6  
   7  import (
   8  	"github.com/p9c/p9/pkg/gel/gio/internal/opconst"
   9  	"github.com/p9c/p9/pkg/gel/gio/io/event"
  10  	"github.com/p9c/p9/pkg/gel/gio/op"
  11  )
  12  
  13  // Op registers a handler for receiving
  14  // Events.
  15  type Op struct {
  16  	Tag event.Tag
  17  }
  18  
  19  // Event contains profile data from a single
  20  // rendered frame.
  21  type Event struct {
  22  	// Timings. Very likely to change.
  23  	Timings string
  24  }
  25  
  26  func (p Op) Add(o *op.Ops) {
  27  	data := o.Write1(opconst.TypeProfileLen, p.Tag)
  28  	data[0] = byte(opconst.TypeProfile)
  29  }
  30  
  31  func (p Event) ImplementsEvent() {}
  32