Documentation ¶
Index ¶
Constants ¶
const Enabled = false
Enabled is used to short circuit tracing-related code in regular builds.
Variables ¶
This section is empty.
Functions ¶
func WithBlockType ¶
WithBlockType creates a context that has an associated BlockType (which ends up in traces created under that context).
Types ¶
type BlockType ¶
type BlockType uint8
BlockType indicates the type of data block relevant to an operation.
type Event ¶
type Event struct { // Event start time as a Unix time (see time.Time.StartUnixNano()). // Note that recorded events are not necessarily ordered by time - this is // because separate event "streams" use local buffers (for performance). StartUnixNano int64 Op OpType Reason Reason BlockType BlockType // LSM level plus one (with 0 indicating unknown level). LevelPlusOne uint8 FileNum base.FileNum // HandleID is a unique identifier corresponding to an objstorage.ReadHandle; // only set for read operations performed through a ReadHandle. HandleID uint64 Offset int64 Size int64 // contains filtered or unexported fields }
Event is the on-disk format of a tracing event. It is exported here so that trace processing tools can use it by importing this package.
type OpType ¶
type OpType uint8
OpType indicates the type of operation.
const ( ReadOp OpType = iota WriteOp // RecordCacheHitOp happens when a read is satisfied from the block cache. See // objstorage.ReadHandle.RecordCacheHit(). RecordCacheHitOp // SetupForCompactionOp is a "meta operation" that configures a read handle // for large sequential reads. See objstorage.ReadHandle.SetupForCompaction(). SetupForCompactionOp )
OpType values.
type Tracer ¶
type Tracer struct{}
Tracer manages the writing of object IO traces to files.
func Open ¶
Open creates a Tracer which generates trace files in the given directory. Each trace file contains a series of Events (as they are in memory).
func (*Tracer) WrapReadable ¶
func (*Tracer) WrapReadable( ctx context.Context, r objstorage.Readable, fileNum base.DiskFileNum, ) objstorage.Readable
WrapReadable wraps an objstorage.Readable with one that generates tracing events.
func (*Tracer) WrapWritable ¶
func (t *Tracer) WrapWritable( ctx context.Context, w objstorage.Writable, fileNum base.DiskFileNum, ) objstorage.Writable
WrapWritable wraps an objstorage.Writable with one that generates tracing events.