Documentation
¶
Index ¶
- Constants
- Variables
- func BeginOpCode(code byte)
- func Finish()
- func FinishNative()
- func FinishRun()
- func FinishStore()
- func Init(filepath string)
- func InitMeasure()
- func NativeCodeString(nativeCode NativeOp) string
- func OpAccumDur(code byte) time.Duration
- func OpCount(code byte) int64
- func ResetRun()
- func ResumeOpCode(code byte)
- func StartNative(nativeCode NativeOp) byte
- func StartStore(storeCode StoreOp) byte
- func StopNative(nativeCode NativeOp, old byte)
- func StopOpCode()
- func StopStore(storeCode StoreOp, old byte, size int)
- func StoreCodeString(storeCode StoreOp) string
- func SwitchOpCode(code byte) byte
- type CPUOp
- type Code
- type NativeOp
- type StoreOp
- type Type
Constants ¶
const Enabled = OpsEnabled || StorageEnabled || NativeEnabled
Enabled is true when any benchmarking build tag is set. Used to gate all timing collection. The specific flags (OpsEnabled, StorageEnabled, NativeEnabled) gate what gets exported.
const NativeEnabled = false
const OpsEnabled = false
const RecordSize int = 14
the byte size of an exported record
const StorageEnabled = false
Variables ¶
var Recording bool
Recording controls whether measurements are exported. Set to false during package loading to avoid contaminating benchmark data with init-phase store operations.
Functions ¶
func BeginOpCode ¶
func BeginOpCode(code byte)
BeginOpCode starts timing the first op in a run loop.
func FinishNative ¶
func FinishNative()
func FinishStore ¶
func FinishStore()
func InitMeasure ¶
func InitMeasure()
func NativeCodeString ¶
func OpAccumDur ¶
OpAccumDur returns the accumulated duration for an op code.
func ResumeOpCode ¶
func ResumeOpCode(code byte)
ResumeOpCode finalizes the current op's elapsed time and resumes a previous op without incrementing its count.
func StartNative ¶
func StartStore ¶
StartStore suspends the current VM op timer and begins a store operation. Returns the old op code for ResumeOpCode.
func StopNative ¶
func StopStore ¶
StopStore ends the store operation, records its duration and size, then resumes the previous VM op.
func StoreCodeString ¶
func SwitchOpCode ¶
SwitchOpCode finalizes the current op's elapsed time and starts timing a new op. Returns the old op code so the caller can pass it to ResumeOpCode when done.
Types ¶
type CPUOp ¶
type CPUOp byte
CPUOp represents a VM opcode for benchmarking. Values mirror gnolang.Op but are defined here to avoid circular imports.
const CPUOpInvalid CPUOp = 0x00
type NativeOp ¶
type NativeOp byte
NativeOp represents a native operation for benchmarking.
const ( NativeOpInvalid NativeOp = 0x00 // invalid NativePrint NativeOp = 0x01 // print to console NativePrint_1 NativeOp = 0x02 // print to console NativePrint_1000 NativeOp = 0x03 NativePrint_10000 NativeOp = 0x04 // print 1000 times to console )
native code
func GetNativePrintCode ¶
type StoreOp ¶
type StoreOp byte
StoreOp represents a store operation for benchmarking.
const ( StoreOpInvalid StoreOp = 0x00 // invalid // gno store StoreGetObject StoreOp = 0x01 // get value and unmarshl to object from store StoreSetObject StoreOp = 0x02 // marshal object and set value in store StoreDeleteObject StoreOp = 0x03 // delete value from store StoreGetPackage StoreOp = 0x04 // get package from store StoreSetPackage StoreOp = 0x05 // get package from store StoreGetType StoreOp = 0x06 // get type from store StoreSetType StoreOp = 0x07 // set type in store StoreGetBlockNode StoreOp = 0x08 // get block node from store StoreSetBlockNode StoreOp = 0x09 // set block node in store StoreAddMemPackage StoreOp = 0x0A // add mempackage to store StoreGetMemPackage StoreOp = 0x0B // get mempackage from store StoreGetPackageRealm StoreOp = 0x0C // add mempackage to store StoreSetPackageRealm StoreOp = 0x0D // get mempackage from store AminoMarshal StoreOp = 0x0E // marshal mem package and realm to binary AminoMarshalAny StoreOp = 0x0F // marshal gno object to binary AminoUnmarshal StoreOp = 0x10 // unmarshl binary to gno object, package and realm // underlying store StoreGet StoreOp = 0x11 // Get binary value by key StoreSet StoreOp = 0x12 // Set binary value by key FinalizeTx StoreOp = 0x13 // finalize transaction // realm operations RealmDidUpdate StoreOp = 0x14 // realm dirty tracking / escape analysis RealmFinalizeTx StoreOp = 0x15 // realm transaction finalization )
store code