Source File
event.go
Belonging Package
internal/trace/raw
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package raw
import (
)
// Event is a simple representation of a trace event.
//
// Note that this typically includes much more than just
// timestamped events, and it also represents parts of the
// trace format's framing. (But not interpreted.)
type Event struct {
Version version.Version
Ev event.Type
Args []uint64
Data []byte
}
// String returns the canonical string representation of the event.
//
// This format is the same format that is parsed by the TextReader
// and emitted by the TextWriter.
func ( *Event) () string {
:= .Version.Specs()[.Ev]
var strings.Builder
.WriteString(.Name)
for := range .Args {
.WriteString(" ")
.WriteString(.Args[])
.WriteString("=")
.WriteString(strconv.FormatUint(.Args[], 10))
}
if .IsStack {
:= .Args[len(.Args):]
for := 0; < len(); ++ {
if %4 == 0 {
.WriteString("\n\t")
} else {
.WriteString(" ")
}
.WriteString(frameFields[%4])
.WriteString("=")
.WriteString(strconv.FormatUint([], 10))
}
}
if .Data != nil {
.WriteString("\n\tdata=")
.WriteString(strconv.Quote(string(.Data)))
}
return .String()
}
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |