github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/io/profile/profile.go (about)

     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/cybriq/giocore/internal/opconst"
     9  	"github.com/cybriq/giocore/io/event"
    10  	"github.com/cybriq/giocore/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() {}