github.com/cockroachdb/pebble@v1.1.2/objstorage/objstorageprovider/objiotracing/obj_io_tracing.go (about) 1 // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package objiotracing 6 7 import "github.com/cockroachdb/pebble/internal/base" 8 9 // OpType indicates the type of operation. 10 type OpType uint8 11 12 // OpType values. 13 const ( 14 ReadOp OpType = iota 15 WriteOp 16 // RecordCacheHitOp happens when a read is satisfied from the block cache. See 17 // objstorage.ReadHandle.RecordCacheHit(). 18 RecordCacheHitOp 19 // SetupForCompactionOp is a "meta operation" that configures a read handle 20 // for large sequential reads. See objstorage.ReadHandle.SetupForCompaction(). 21 SetupForCompactionOp 22 ) 23 24 // Reason indicates the higher-level context of the operation. 25 type Reason uint8 26 27 // Reason values. 28 const ( 29 UnknownReason Reason = iota 30 ForFlush 31 ForCompaction 32 ForIngestion 33 // TODO(radu): add ForUserFacing. 34 ) 35 36 // BlockType indicates the type of data block relevant to an operation. 37 type BlockType uint8 38 39 // BlockType values. 40 const ( 41 UnknownBlock BlockType = iota 42 DataBlock 43 ValueBlock 44 FilterBlock 45 MetadataBlock 46 ) 47 48 // Event is the on-disk format of a tracing event. It is exported here so that 49 // trace processing tools can use it by importing this package. 50 type Event struct { 51 // Event start time as a Unix time (see time.Time.StartUnixNano()). 52 // Note that recorded events are not necessarily ordered by time - this is 53 // because separate event "streams" use local buffers (for performance). 54 StartUnixNano int64 55 Op OpType 56 Reason Reason 57 BlockType BlockType 58 // LSM level plus one (with 0 indicating unknown level). 59 LevelPlusOne uint8 60 // Hardcoded padding so that struct layout doesn't depend on architecture. 61 _ uint32 62 FileNum base.FileNum 63 // HandleID is a unique identifier corresponding to an objstorage.ReadHandle; 64 // only set for read operations performed through a ReadHandle. 65 HandleID uint64 66 Offset int64 67 Size int64 68 }