Documentation
¶
Overview ¶
Package wire defines the bounded, versioned records exchanged by a CUDA capture agent and its controller.
Index ¶
Constants ¶
const ( Version uint16 = 1 HeaderSize = 80 DefaultMaxPayload = 16 << 20 DefaultMaxRecords = 4096 DefaultQueueBytes = 64 << 20 )
const ( KindBootstrap uint16 = 1 KindActivity uint16 = 2 KindFinalized uint16 = 3 KindCapability uint16 = 4 KindFailure uint16 = 5 KindExternal uint16 = 6 KindAPI uint16 = 7 KindHost uint16 = 8 KindModule uint16 = 9 KindPCSample uint16 = 10 KindGEMM uint16 = 11 KindWindow uint16 = 12 KindAPICalls uint16 = 13 KindArgs uint16 = 14 KindDiag uint16 = 15 // KindAPICallback is one runtime or driver API call as the callback // API saw it, written only under CUDAPROF_API_CALLBACKS=all. KindAPICallback uint16 = 16 // KindPMSample is one periodic PM sampling metric sample or summary, // written only under CUDAPROF_PM_SAMPLING=1. KindPMSample uint16 = 17 )
Record kinds. They match the KIND_ constants in the capture agent (native/cupti_agent.c); a test in this package checks that they agree.
Variables ¶
var ( ErrBadMagic = errors.New("wire: bad magic") ErrBadVersion = errors.New("wire: unsupported version") ErrMalformed = errors.New("wire: malformed frame") ErrOversize = errors.New("wire: frame exceeds limit") ErrSession = errors.New("wire: session identity mismatch") ErrDuplicate = errors.New("wire: duplicate sequence") ErrRecordLimit = errors.New("wire: record count exceeds limit") ErrQueueFull = errors.New("wire: queue full") )
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder validates framing and maintains sequence/drop accounting.
func (*Decoder) ExpectSession ¶
type Identity ¶
Identity distinguishes a capture session and a process generation. Process is normally a PID; Generation must change across exec or PID reuse.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a bounded nonblocking producer queue. Push copies the payload.
type Record ¶
type Record struct {
Kind uint16
Identity
Sequence uint64
Dropped uint64
Timestamp uint64
Payload []byte
}
Record is one independently framed observation. Sequence numbers start at one within each process generation. Dropped is cumulative producer loss.
Timestamp is nanoseconds on CLOCK_MONOTONIC in the producing process, and says when the observation happened rather than when the record was framed. A record carrying a CUPTI activity is stamped with that activity's own start, which CUPTI takes on the same clock because the agent registers itself as CUPTI's timestamp source; a record the agent originates -- the bootstrap, the capability, a capture-range edge, a failure, the finalized record -- is stamped when the agent wrote it. The guarantee is that those are one clock, so within a process generation a capture-range edge really does bracket the device activity recorded between its edges and the interval between any two records is a duration. External-correlation records are the exception: they observe an identifier and not an instant, and carry zero.
Three limits come with that clock. It is not comparable across processes generally, and Identity is what separates the streams. It has no relation to wall-clock time, so it cannot be joined to anything timestamped by a clock outside the process. And an agent whose CUPTI could not accept the timestamp callback leaves CUPTI on its platform default -- CLOCK_REALTIME on Linux -- which differs from CLOCK_MONOTONIC by the host's boot time; such an agent says so in its capability record (clocks_unified), and a consumer that compares timestamps across kinds must read it, because nothing in this header distinguishes the two cases.