github.com/Seikaijyu/gio@v0.0.1/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/Seikaijyu/gio/internal/ops"
     9  	"github.com/Seikaijyu/gio/io/event"
    10  	"github.com/Seikaijyu/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 := ops.Write1(&o.Internal, ops.TypeProfileLen, p.Tag)
    28  	data[0] = byte(ops.TypeProfile)
    29  }
    30  
    31  func (p Event) ImplementsEvent() {}