jit

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package jit provides a parser for Perf's JITDUMP files

Index

Constants

View Source
const (
	JITCodeLoad          JITRecordType = 0    // record describing a jitted function
	JITCodeMove                        = 1    // record describing an already jitted function which is moved
	JITCodeDebugInfo                   = 2    // record describing the debug information for a jitted function
	JITCodeClose                       = 3    // record marking the end of the jit runtime (optional)
	JITCodeUnwindingInfo               = 4    // record describing a function unwinding information
	JITCodeMax                         = iota // maximum record type
)
View Source
const JITHeaderVersion = 1

JITHeaderVersion is the supported version of the JITDUMP specification.

Variables

View Source
var (
	// ErrWrongJITDumpMagic is the error returned when the magic in the JITDUMP header is not recognized.
	ErrWrongJITDumpMagic = errors.New("wrong JITDUMP magic")
	// ErrWrongJITDumpVersion is the error returned when the version in the JITDUMP header is not 1.
	ErrWrongJITDumpVersion = errors.New("wrong JITDUMP version")
)

Functions

func LoadJITDump

func LoadJITDump(logger log.Logger, rd io.Reader, dump *JITDump) error

LoadJITDump loads a jitdump file into dump.

Types

type DebugEntry

type DebugEntry struct {
	Addr    uint64 // address of function for which the debug information is generated
	Lineno  uint32 // source file line number (starting at 1)
	Discrim uint32 // column discriminator, 0 is default
	Name    string // source file name in ASCII
}

DebugEntry reprensents an entry from a JITCodeDebugInfo record.

type JITDump

type JITDump struct {
	Header        *JITHeader             // the jitdump file header
	CodeLoads     []*JRCodeLoad          // JITCodeLoad records
	CodeMoves     []*JRCodeMove          // JITCodeMove records
	DebugInfo     []*JRCodeDebugInfo     // JITCodeDebugInfo records
	UnwindingInfo []*JRCodeUnwindingInfo // JITCodeUnwindingInfo records
}

nolint: musttag // JSON is used for testing only JITDump represents the loaded jitdump.

type JITHeader

type JITHeader struct {
	Magic     uint32 // a magic number tagging the file type
	Version   uint32 // a 4-byte value representing the format version. It is currently set to 1
	TotalSize uint32 // size in bytes of file header
	ElfMach   uint32 // ELF architecture encoding (ELF e_machine value as specified in /usr/include/elf.h)
	Pad1      uint32 // padding. Reserved for future use
	Pid       uint32 // JIT runtime process identification (OS specific)
	Timestamp uint64 // timestamp of when the file was created
	Flags     uint64 // a bitmask of flags
}

JITHeader represent a jitdump file header.

type JITRecordType

type JITRecordType uint32

JITRecordType is the value identifying the record type.

type JRCodeDebugInfo

type JRCodeDebugInfo struct {
	Prefix   *JRPrefix     // the record header
	CodeAddr uint64        // address of function for which the debug information is generated
	NREntry  uint64        // number of debug entries for the function
	Entries  []*DebugEntry // array of NREntry debug entries for the function
}

JRCodeDebugInfo represents a JITCodeDebugInfo record.

type JRCodeLoad

type JRCodeLoad struct {
	Prefix    *JRPrefix // the record header
	PID       uint32    // OS process id of the runtime generating the jitted code
	TID       uint32    // OS thread identification of the runtime thread generating the jitted code
	VMA       uint64    // virtual address of jitted code start
	CodeAddr  uint64    // code start address for the jitted code. By default VMA = CodeAddr
	CodeSize  uint64    // size in bytes of the generated jitted code
	CodeIndex uint64    // unique identifier for the jitted code
	Name      string    // function name in ASCII
	Code      []byte    // raw byte encoding of the jitted code
}

JRCodeLoad represents a JITCodeLoad record.

type JRCodeMove

type JRCodeMove struct {
	Prefix      *JRPrefix // the record header
	PID         uint32    // OS process id of the runtime generating the jitted code
	TID         uint32    // OS thread identification of the runtime thread generating the jitted code
	VMA         uint64    // new virtual address of jitted code start
	OldCodeAddr uint64    // previous code address for the same function
	NewCodeAddr uint64    // alternate new code started address for the jitted code. By default it should be equal to the VMA address.
	CodeSize    uint64    // size in bytes of the jitted code
	CodeIndex   uint64    // index referring to the JRCodeLoad CodeIndex record of when the function was initially jitted
}

JRCodeMove represents a JITCodeMove record.

type JRCodeUnwindingInfo

type JRCodeUnwindingInfo struct {
	Prefix         *JRPrefix // the record header
	UnwindingSize  uint64    // the size in bytes of the unwinding data table at the end of the record
	EHFrameHDRSize uint64    // the size in bytes of the DWARF EH Frame Header at the start of the unwinding data table at the end of the record
	MappedSize     uint64    // the size of the unwinding data mapped in memory
	UnwindingData  []byte    // an array of unwinding data, consisting of the EH Frame Header, followed by the actual EH Frame
}

JRCodeUnwindingInfo represents a JITCodeUnwindingInfo record.

type JRPrefix

type JRPrefix struct {
	ID        JITRecordType // a value identifying the record type
	TotalSize uint32        // the size in bytes of the record including the header
	Timestamp uint64        // a timestamp of when the record was created
}

JRPrefix describes the record that follows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL