hprof

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing and analysis functionality for Java HPROF heap dump files.

This package is a thin wrapper around github.com/junjiewwang/perf-analysis/perflib/parser/hprof, providing backward compatibility for the internal API.

Key Types

  • Parser: Main HPROF parser
  • ReferenceGraph: Object reference graph with GC root tracking
  • BiggestObjectsBuilder: Builds biggest objects list with lazy field loading
  • HeapAnalysisResult: Complete analysis result

Usage Example

parser := hprof.NewParser(hprof.DefaultParserOptions())
result, err := parser.Parse(ctx, reader)
if err != nil {
    log.Fatal(err)
}

// Access analysis results
for _, cls := range result.TopClasses {
    fmt.Printf("%s: %d instances, %d bytes\n",
        cls.ClassName, cls.InstanceCount, cls.TotalSize)
}

Package hprof provides parsing functionality for Java HPROF heap dump files.

This file previously contained the dominator tree computation logic. All functionality has been moved to perflib/parser/hprof. Methods on ReferenceGraph (ComputeDominatorTree, SetRetainedSizeStrategy, etc.) are automatically available through the ReferenceGraph type alias.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Package hprof provides parsing functionality for Java HPROF heap dump files.

Index

Constants

View Source
const (
	// RetainedSizeStrategyStandard uses strict dominator-tree based calculation (Eclipse MAT style).
	RetainedSizeStrategyStandard = libhprof.RetainedSizeStrategyStandard

	// RetainedSizeStrategyIDEA uses IDEA-style calculation that includes logically owned objects.
	RetainedSizeStrategyIDEA = libhprof.RetainedSizeStrategyIDEA
)
View Source
const (
	// FindingInfo indicates an informational finding.
	FindingInfo = libhprof.FindingInfo

	// FindingWarning indicates a warning finding.
	FindingWarning = libhprof.FindingWarning

	// FindingCritical indicates a critical finding.
	FindingCritical = libhprof.FindingCritical
)
View Source
const (
	// DominatorAlgorithmAuto automatically selects the best algorithm.
	DominatorAlgorithmAuto = libhprof.DominatorAlgorithmAuto

	// DominatorAlgorithmLengauerTarjan uses the classic Lengauer-Tarjan algorithm.
	DominatorAlgorithmLengauerTarjan = libhprof.DominatorAlgorithmLengauerTarjan

	// DominatorAlgorithmHierarchical uses the hierarchical parallel algorithm.
	DominatorAlgorithmHierarchical = libhprof.DominatorAlgorithmHierarchical
)
View Source
const (
	GCRootUnknown      = libhprof.GCRootUnknown
	GCRootJNIGlobal    = libhprof.GCRootJNIGlobal
	GCRootJNILocal     = libhprof.GCRootJNILocal
	GCRootJavaFrame    = libhprof.GCRootJavaFrame
	GCRootNativeStack  = libhprof.GCRootNativeStack
	GCRootStickyClass  = libhprof.GCRootStickyClass
	GCRootThreadBlock  = libhprof.GCRootThreadBlock
	GCRootMonitorUsed  = libhprof.GCRootMonitorUsed
	GCRootThreadObject = libhprof.GCRootThreadObject
)
View Source
const (
	// SizeModeCompressedOops uses compressed oops (12-byte header, 4-byte refs).
	SizeModeCompressedOops = libhprof.SizeModeCompressedOops

	// SizeModeNonCompressed uses non-compressed oops (16-byte header, 8-byte refs).
	SizeModeNonCompressed = libhprof.SizeModeNonCompressed

	// SizeModeAuto automatically detects based on heap size.
	SizeModeAuto = libhprof.SizeModeAuto
)
View Source
const (
	// SerializerVersion is the current serialization format version.
	SerializerVersion = libhprof.SerializerVersion

	// MagicBytes are the magic bytes for file format identification.
	MagicBytes = libhprof.MagicBytes
)
View Source
const (
	TagString          = libhprof.TagString
	TagLoadClass       = libhprof.TagLoadClass
	TagUnloadClass     = libhprof.TagUnloadClass
	TagStackFrame      = libhprof.TagStackFrame
	TagStackTrace      = libhprof.TagStackTrace
	TagAllocSites      = libhprof.TagAllocSites
	TagHeapSummary     = libhprof.TagHeapSummary
	TagStartThread     = libhprof.TagStartThread
	TagEndThread       = libhprof.TagEndThread
	TagHeapDump        = libhprof.TagHeapDump
	TagHeapDumpSegment = libhprof.TagHeapDumpSegment
	TagHeapDumpEnd     = libhprof.TagHeapDumpEnd
	TagCPUSamples      = libhprof.TagCPUSamples
	TagControlSettings = libhprof.TagControlSettings
)
View Source
const (
	HeapTagRootUnknown        = libhprof.HeapTagRootUnknown
	HeapTagRootJNIGlobal      = libhprof.HeapTagRootJNIGlobal
	HeapTagRootJNILocal       = libhprof.HeapTagRootJNILocal
	HeapTagRootJavaFrame      = libhprof.HeapTagRootJavaFrame
	HeapTagRootNativeStack    = libhprof.HeapTagRootNativeStack
	HeapTagRootStickyClass    = libhprof.HeapTagRootStickyClass
	HeapTagRootThreadBlock    = libhprof.HeapTagRootThreadBlock
	HeapTagRootMonitorUsed    = libhprof.HeapTagRootMonitorUsed
	HeapTagRootThreadObject   = libhprof.HeapTagRootThreadObject
	HeapTagClassDump          = libhprof.HeapTagClassDump
	HeapTagInstanceDump       = libhprof.HeapTagInstanceDump
	HeapTagObjectArrayDump    = libhprof.HeapTagObjectArrayDump
	HeapTagPrimitiveArrayDump = libhprof.HeapTagPrimitiveArrayDump
)
View Source
const (
	TypeObject  = libhprof.TypeObject
	TypeBoolean = libhprof.TypeBoolean
	TypeChar    = libhprof.TypeChar
	TypeFloat   = libhprof.TypeFloat
	TypeDouble  = libhprof.TypeDouble
	TypeByte    = libhprof.TypeByte
	TypeShort   = libhprof.TypeShort
	TypeInt     = libhprof.TypeInt
	TypeLong    = libhprof.TypeLong
)
View Source
const (
	// CompressionGzip uses gzip compression (legacy, slower but widely compatible)
	CompressionGzip = libhprof.CompressionGzip
	// CompressionZstd uses zstd compression (faster and better compression ratio)
	CompressionZstd = libhprof.CompressionZstd
)
View Source
const (
	// CompressionFastest prioritizes speed over compression ratio
	CompressionFastest = libhprof.CompressionFastest
	// CompressionDefault balances speed and compression ratio
	CompressionDefault = libhprof.CompressionDefault
	// CompressionBest prioritizes compression ratio over speed
	CompressionBest = libhprof.CompressionBest
)
View Source
const MaxObjectsForRetainerAnalysis = libhprof.MaxObjectsForRetainerAnalysis

MaxObjectsForRetainerAnalysis is the maximum number of target objects to analyze.

Variables

View Source
var (
	// Int32SlicePool is a sync.Pool for int32 slices.
	Int32SlicePool = libhprof.Int32SlicePool

	// Int64SlicePool is a sync.Pool for int64 slices.
	Int64SlicePool = libhprof.Int64SlicePool

	// Uint64SlicePool is a sync.Pool for uint64 slices.
	Uint64SlicePool = libhprof.Uint64SlicePool

	// QueuePool is a sync.Pool for QueueItem slices.
	QueuePool = libhprof.QueuePool

	// PathPool is a sync.Pool for int32 path slices.
	PathPool = libhprof.PathPool

	// Int64MapPool is a sync.Pool for map[uint64]int64.
	Int64MapPool = libhprof.Int64MapPool

	// BoolMapPool is a sync.Pool for map[int32]bool.
	BoolMapPool = libhprof.BoolMapPool

	// Uint64BoolMapPool is a sync.Pool for map[uint64]bool.
	Uint64BoolMapPool = libhprof.Uint64BoolMapPool
)
View Source
var CollectionClasses = libhprof.CollectionClasses

CollectionClasses defines Java collection classes that use Object[] internally.

Functions

func AutoDecompress

func AutoDecompress(data []byte) ([]byte, error)

AutoDecompress automatically detects compression type and decompresses data.

func BasicTypeSize

func BasicTypeSize(t BasicType, idSize int) int

BasicTypeSize returns the size in bytes for a basic type.

func BuildIncomingRefsParallel

func BuildIncomingRefsParallel(refs []GraphEdge) map[uint64][]ObjectReference

BuildIncomingRefsParallel builds incoming references map in parallel.

func ComputeClassRetainedSizesHierarchical

func ComputeClassRetainedSizesHierarchical(ctx context.Context, g *ReferenceGraph) (map[uint64]int64, map[uint64]int64)

ComputeClassRetainedSizesHierarchical computes class retained sizes in parallel.

func ComputeClassStatsParallel

func ComputeClassStatsParallel(g *ReferenceGraph, includeRetained bool) map[uint64]ClassStatsAccumulator

ComputeClassStatsParallel computes class statistics in parallel.

func ComputeDominatorsAdaptive

func ComputeDominatorsAdaptive(ctx context.Context, g *ReferenceGraph)

ComputeDominatorsAdaptive computes dominators using the best algorithm.

func ComputeHierarchicalDominators

func ComputeHierarchicalDominators(ctx context.Context, g *ReferenceGraph, config HierarchicalDominatorConfig)

ComputeHierarchicalDominators computes dominators using the hierarchical parallel algorithm.

func ForEach

func ForEach[T any](
	ctx context.Context,
	items []T,
	config PoolConfig,
	fn func(ctx context.Context, item T) error,
) (processed int64, firstError error)

ForEach executes a function for each item in parallel.

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes formats bytes to human-readable string.

func FormatBytesSize

func FormatBytesSize(bytes int64) string

FormatBytesSize formats bytes to human-readable string.

func GetBoolMap

func GetBoolMap() map[int32]bool

GetBoolMap gets a map[int32]bool from the pool.

func GetInt32Slice

func GetInt32Slice() *[]int32

GetInt32Slice gets an int32 slice from the pool.

func GetInt64Map

func GetInt64Map() map[uint64]int64

GetInt64Map gets a map[uint64]int64 from the pool.

func GetInt64Slice

func GetInt64Slice() *[]int64

GetInt64Slice gets an int64 slice from the pool.

func GetPath

func GetPath() *[]int32

GetPath gets an int32 path slice from the pool.

func GetQueue

func GetQueue() *[]QueueItem

GetQueue gets a QueueItem slice from the pool.

func GetUint64BoolMap

func GetUint64BoolMap() map[uint64]bool

GetUint64BoolMap gets a map[uint64]bool from the pool.

func GetUint64Slice

func GetUint64Slice() *[]uint64

GetUint64Slice gets a uint64 slice from the pool.

func IsCollectionClass

func IsCollectionClass(className string) bool

IsCollectionClass checks if a class is a Java collection class.

func MapReduce

func MapReduce[T any, M any, R any](
	ctx context.Context,
	items []T,
	config PoolConfig,
	mapper func(ctx context.Context, item T) M,
	reducer func(mapped []M) R,
) R

MapReduce applies a map function to each item in parallel and reduces the results.

func ParallelAggregate

func ParallelAggregate[T any, K comparable, V any](
	ctx context.Context,
	items []T,
	config PoolConfig,
	extractor func(item T) (key K, value V),
	merger func(existing, new V) V,
) map[K]V

ParallelAggregate aggregates data in parallel using per-worker local maps.

func ProcessObjectsParallel

func ProcessObjectsParallel[R any](
	g *ReferenceGraph,
	processor func(objID uint64, classID uint64, size int64) R,
	reducer func(results []R) R,
) R

ProcessObjectsParallel processes objects in parallel with a custom function.

func PutBoolMap

func PutBoolMap(m map[int32]bool)

PutBoolMap returns a map[int32]bool to the pool.

func PutInt32Slice

func PutInt32Slice(s *[]int32)

PutInt32Slice returns an int32 slice to the pool.

func PutInt64Map

func PutInt64Map(m map[uint64]int64)

PutInt64Map returns a map[uint64]int64 to the pool.

func PutInt64Slice

func PutInt64Slice(s *[]int64)

PutInt64Slice returns an int64 slice to the pool.

func PutPath

func PutPath(p *[]int32)

PutPath returns an int32 path slice to the pool.

func PutQueue

func PutQueue(q *[]QueueItem)

PutQueue returns a QueueItem slice to the pool.

func PutUint64BoolMap

func PutUint64BoolMap(m map[uint64]bool)

PutUint64BoolMap returns a map[uint64]bool to the pool.

func PutUint64Slice

func PutUint64Slice(s *[]uint64)

PutUint64Slice returns a uint64 slice to the pool.

func SerializeToFileAsync

func SerializeToFileAsync(ctx context.Context, g *ReferenceGraph, filename string, opts SerializeOptions) (<-chan *AsyncSerializationResult, error)

SerializeToFileAsync is a convenience function that serializes asynchronously.

func SerializeToFileWithCallback

func SerializeToFileWithCallback(ctx context.Context, g *ReferenceGraph, filename string, opts SerializeOptions, callback func(*AsyncSerializationResult))

SerializeToFileWithCallback serializes asynchronously and calls the callback when done.

func ShouldUseMmap

func ShouldUseMmap(objectCount int, config MmapConfig) bool

ShouldUseMmap determines if mmap should be used based on object count and config.

Types

type AggregateResult

type AggregateResult[K comparable, V any] = libhprof.AggregateResult[K, V]

AggregateResult is an alias to perflib hprof AggregateResult.

type AnalysisOptions

type AnalysisOptions = libhprof.AnalysisOptions

AnalysisOptions configures analysis behavior.

func DefaultAnalysisOptions

func DefaultAnalysisOptions() AnalysisOptions

DefaultAnalysisOptions returns default analysis options.

type AnalysisStats

type AnalysisStats = libhprof.AnalysisStats

AnalysisStats holds statistics about the analysis.

type AnalysisStrategy

type AnalysisStrategy = libhprof.AnalysisStrategy

AnalysisStrategy defines the interface for pluggable analysis strategies.

type AnalysisTask

type AnalysisTask = libhprof.AnalysisTask

AnalysisTask represents a unit of analysis work.

type AnalyzerConfig

type AnalyzerConfig = libhprof.AnalyzerConfig

AnalyzerConfig holds configuration for the analyzer.

func DefaultAnalyzerConfig

func DefaultAnalyzerConfig() *AnalyzerConfig

DefaultAnalyzerConfig returns the default configuration.

type ArrayInfo

type ArrayInfo = libhprof.ArrayInfo

ArrayInfo holds array metadata.

type ArrayStats

type ArrayStats = libhprof.ArrayStats

ArrayStats holds array-related statistics.

type AsyncSerializationResult

type AsyncSerializationResult = libhprof.AsyncSerializationResult

AsyncSerializationResult holds the result of an async serialization operation.

type AsyncSerializer

type AsyncSerializer = libhprof.AsyncSerializer

AsyncSerializer provides asynchronous serialization capabilities.

func GetBackgroundSerializer

func GetBackgroundSerializer() *AsyncSerializer

GetBackgroundSerializer returns the global background serializer instance.

func NewAsyncSerializer

func NewAsyncSerializer(maxConcurrentJobs int) *AsyncSerializer

NewAsyncSerializer creates a new async serializer.

type AtomicBitset

type AtomicBitset = libhprof.AtomicBitset

AtomicBitset is an alias to perflib hprof AtomicBitset.

func NewAtomicBitset

func NewAtomicBitset(size int) *AtomicBitset

NewAtomicBitset creates a new atomic bitset.

type BFSContext

type BFSContext = libhprof.BFSContext

BFSContext holds context for BFS traversal.

func NewBFSContext

func NewBFSContext(maxSize int) *BFSContext

NewBFSContext creates a new BFS context.

type BFSContextPool

type BFSContextPool = libhprof.BFSContextPool

BFSContextPool manages a pool of BFS contexts.

func NewBFSContextPool

func NewBFSContextPool(maxSize int) *BFSContextPool

NewBFSContextPool creates a new BFS context pool.

type BasicType

type BasicType = libhprof.BasicType

BasicType represents Java primitive types.

type BiggestObject

type BiggestObject = libhprof.BiggestObject

BiggestObject represents a large object with its field values.

type BiggestObjectsBuilder

type BiggestObjectsBuilder = libhprof.BiggestObjectsBuilder

BiggestObjectsBuilder builds the biggest objects list with lazy field loading.

func NewBiggestObjectsBuilder

func NewBiggestObjectsBuilder(refGraph *ReferenceGraph, classLayouts map[uint64]*ClassFieldLayout, strings map[uint64]string) *BiggestObjectsBuilder

NewBiggestObjectsBuilder creates a new biggest objects builder.

type Bitset

type Bitset = libhprof.Bitset

Bitset is an alias to perflib hprof Bitset.

func NewBitset

func NewBitset(size int) *Bitset

NewBitset creates a new bitset with the given size.

func NewBitsetWithCapacity

func NewBitsetWithCapacity(size, capacity int) *Bitset

NewBitsetWithCapacity creates a new bitset with extra capacity for growth.

type BusinessRetainer

type BusinessRetainer = libhprof.BusinessRetainer

BusinessRetainer represents a business-level retainer with full path information.

type BusinessRetainerResult

type BusinessRetainerResult = libhprof.BusinessRetainerResult

BusinessRetainerResult holds the result of business retainer analysis.

type ChildrenBuilder

type ChildrenBuilder = libhprof.ChildrenBuilder

ChildrenBuilder builds children lists for dominator tree.

func NewChildrenBuilder

func NewChildrenBuilder(nodeCount int) *ChildrenBuilder

NewChildrenBuilder creates a new children builder.

type ChunkProcessor

type ChunkProcessor[T any, R any] = libhprof.ChunkProcessor[T, R]

ChunkProcessor is an alias to perflib hprof ChunkProcessor.

func NewChunkProcessor

func NewChunkProcessor[T any, R any](config PoolConfig) *ChunkProcessor[T, R]

NewChunkProcessor creates a new chunk processor.

type ClassFieldLayout

type ClassFieldLayout = libhprof.ClassFieldLayout

ClassFieldLayout describes the field layout of a class for field value extraction.

type ClassInfo

type ClassInfo = libhprof.ClassInfo

ClassInfo holds class metadata.

type ClassRetainers

type ClassRetainers = libhprof.ClassRetainers

ClassRetainers holds retainer information for a class.

type ClassStats

type ClassStats = libhprof.ClassStats

ClassStats holds aggregated statistics for a class.

type ClassStatsAccumulator

type ClassStatsAccumulator = libhprof.ClassStatsAccumulator

ClassStatsAccumulator accumulates class statistics.

type CompactEdgeList

type CompactEdgeList = libhprof.CompactEdgeList

CompactEdgeList stores edges in CSR format.

func NewCompactEdgeList

func NewCompactEdgeList(nodeCount int, estimatedEdges int) *CompactEdgeList

NewCompactEdgeList creates a new compact edge list.

type CompactEdgeListBuilder

type CompactEdgeListBuilder = libhprof.CompactEdgeListBuilder

CompactEdgeListBuilder builds a CompactEdgeList.

func NewCompactEdgeListBuilder

func NewCompactEdgeListBuilder(nodeCount int, estimatedEdges int) *CompactEdgeListBuilder

NewCompactEdgeListBuilder creates a new compact edge list builder.

type CompressionLevel

type CompressionLevel = libhprof.CompressionLevel

CompressionLevel is an alias to perflib hprof CompressionLevel.

type CompressionType

type CompressionType = libhprof.CompressionType

CompressionType is an alias to perflib hprof CompressionType.

type Compressor

type Compressor = libhprof.Compressor

Compressor is an alias to perflib hprof Compressor.

func DefaultCompressor

func DefaultCompressor() Compressor

DefaultCompressor returns the default compressor (zstd with default level).

func FastCompressor

func FastCompressor() Compressor

FastCompressor returns a fast compressor optimized for speed.

type ConcurrentMap

type ConcurrentMap[K comparable, V any] = libhprof.ConcurrentMap[K, V]

ConcurrentMap is a thread-safe map wrapper.

func NewConcurrentMap

func NewConcurrentMap[K comparable, V any]() *ConcurrentMap[K, V]

NewConcurrentMap creates a new concurrent map.

func NewConcurrentMapWithCapacity

func NewConcurrentMapWithCapacity[K comparable, V any](capacity int) *ConcurrentMap[K, V]

NewConcurrentMapWithCapacity creates a new concurrent map with initial capacity.

type DominatorAlgorithm

type DominatorAlgorithm = libhprof.DominatorAlgorithm

DominatorAlgorithm represents the algorithm to use for dominator computation.

func SelectDominatorAlgorithm

func SelectDominatorAlgorithm(objectCount int, edgeCount int) DominatorAlgorithm

SelectDominatorAlgorithm selects the best algorithm based on graph characteristics.

type DominatorMetrics

type DominatorMetrics = libhprof.DominatorMetrics

DominatorMetrics tracks performance metrics for dominator computation.

type FieldAnalysisResult

type FieldAnalysisResult = libhprof.FieldAnalysisResult

FieldAnalysisResult holds analysis result for a single field.

type FieldDescriptor

type FieldDescriptor = libhprof.FieldDescriptor

FieldDescriptor describes a field in a class.

type FieldInfo

type FieldInfo = libhprof.FieldInfo

FieldInfo describes an instance field.

type Finding

type Finding = libhprof.Finding

Finding represents a single finding from the analysis.

type FindingLevel

type FindingLevel = libhprof.FindingLevel

FindingLevel indicates the severity of a finding.

type FullAnalysisResult

type FullAnalysisResult = libhprof.FullAnalysisResult

FullAnalysisResult holds the complete result of all parallel analysis.

type GCRoot

type GCRoot = libhprof.GCRoot

GCRoot represents a garbage collection root.

type GCRootClassSummary

type GCRootClassSummary = libhprof.GCRootClassSummary

GCRootClassSummary represents GC roots grouped by class name.

type GCRootInfo

type GCRootInfo = libhprof.GCRootInfo

GCRootInfo represents aggregated information about a GC root for display.

type GCRootInstanceInfo

type GCRootInstanceInfo = libhprof.GCRootInstanceInfo

GCRootInstanceInfo represents a single GC root instance.

type GCRootPath

type GCRootPath = libhprof.GCRootPath

GCRootPath represents a path from a GC Root to an object.

type GCRootSummary

type GCRootSummary = libhprof.GCRootSummary

GCRootSummary represents a summary of GC roots grouped by class.

type GCRootType

type GCRootType = libhprof.GCRootType

GCRootType represents the type of GC root.

type GCRootsAnalysis

type GCRootsAnalysis = libhprof.GCRootsAnalysis

GCRootsAnalysis holds GC roots analysis data for persistence.

type GraphEdge

type GraphEdge = libhprof.GraphEdge

GraphEdge represents an edge in the reference graph.

type GraphResult

type GraphResult = libhprof.GraphResult

GraphResult holds the result of reference graph analysis.

type GzipCompressor

type GzipCompressor = libhprof.GzipCompressor

GzipCompressor is an alias to perflib hprof GzipCompressor.

func NewGzipCompressor

func NewGzipCompressor(level CompressionLevel) *GzipCompressor

NewGzipCompressor creates a new gzip compressor.

type Header = libhprof.Header

Header represents the HPROF file header.

type HeapAnalysisResult

type HeapAnalysisResult = libhprof.HeapAnalysisResult

HeapAnalysisResult holds the complete analysis result.

type HeapDumpTag

type HeapDumpTag = libhprof.HeapDumpTag

HeapDumpTag represents sub-tags within a heap dump record.

type HeapSummary

type HeapSummary = libhprof.HeapSummary

HeapSummary holds heap summary statistics.

type HierarchicalDominatorConfig

type HierarchicalDominatorConfig = libhprof.HierarchicalDominatorConfig

HierarchicalDominatorConfig configures the hierarchical dominator algorithm.

func DefaultHierarchicalDominatorConfig

func DefaultHierarchicalDominatorConfig() HierarchicalDominatorConfig

DefaultHierarchicalDominatorConfig returns default configuration.

type HolderTypeAnalysisStrategy

type HolderTypeAnalysisStrategy = libhprof.HolderTypeAnalysisStrategy

HolderTypeAnalysisStrategy analyzes holder types.

type HolderTypeStats

type HolderTypeStats = libhprof.HolderTypeStats

HolderTypeStats holds statistics grouped by holder type.

type IDEAStyleRetainedResult

type IDEAStyleRetainedResult = libhprof.IDEAStyleRetainedResult

IDEAStyleRetainedResult holds the result of IDEA-style retained size calculation.

type IDEAStyleRetainedSizeCalculator

type IDEAStyleRetainedSizeCalculator = libhprof.IDEAStyleRetainedSizeCalculator

IDEAStyleRetainedSizeCalculator implements IDEA-style retained size calculation.

type IndexedObjectStore

type IndexedObjectStore = libhprof.IndexedObjectStore

IndexedObjectStore provides compact indexed storage for objects.

func NewIndexedObjectStore

func NewIndexedObjectStore(estimatedObjects int) *IndexedObjectStore

NewIndexedObjectStore creates a new indexed object store.

type IndexedOutRef

type IndexedOutRef = libhprof.IndexedOutRef

IndexedOutRef represents an outgoing/incoming reference using compact index.

type IndexedReference

type IndexedReference = libhprof.IndexedReference

IndexedReference represents a reference using compact indices instead of object IDs.

type IndexedReferenceGraph

type IndexedReferenceGraph = libhprof.IndexedReferenceGraph

IndexedReferenceGraph provides a high-performance indexed reference graph.

func NewIndexedReferenceGraph

func NewIndexedReferenceGraph(estimatedObjects int) *IndexedReferenceGraph

NewIndexedReferenceGraph creates a new indexed reference graph.

type InstanceAnalysisContext

type InstanceAnalysisContext = libhprof.InstanceAnalysisContext

InstanceAnalysisContext holds all the analysis data for a single instance.

type InstanceAnalysisResult

type InstanceAnalysisResult = libhprof.InstanceAnalysisResult

InstanceAnalysisResult holds analysis result for a single instance.

type InstanceInfo

type InstanceInfo = libhprof.InstanceInfo

InstanceInfo holds instance metadata.

type Int32Stack

type Int32Stack = libhprof.Int32Stack

Int32Stack is a stack of int32 values.

func NewInt32Stack

func NewInt32Stack(capacity int) *Int32Stack

NewInt32Stack creates a new int32 stack.

type LevelDominatorState

type LevelDominatorState = libhprof.LevelDominatorState

LevelDominatorState holds state for level-based parallel dominator computation.

func NewLevelDominatorState

func NewLevelDominatorState(nodeCount int, config HierarchicalDominatorConfig) *LevelDominatorState

NewLevelDominatorState creates a new level-based dominator state.

type MmapArray

type MmapArray[T any] = libhprof.MmapArray[T]

MmapArray provides a memory-mapped array backed by a file.

func NewMmapArray

func NewMmapArray[T any](filename string, initialCapacity int64) (*MmapArray[T], error)

NewMmapArray creates a new memory-mapped array.

type MmapConfig

type MmapConfig = libhprof.MmapConfig

MmapConfig configures memory-mapped storage behavior.

func DefaultMmapConfig

func DefaultMmapConfig() MmapConfig

DefaultMmapConfig returns default mmap configuration.

type MmapEdgeStore

type MmapEdgeStore = libhprof.MmapEdgeStore

MmapEdgeStore provides memory-mapped storage for graph edges.

func NewMmapEdgeStore

func NewMmapEdgeStore(nodeCount int, estimatedEdges int) (*MmapEdgeStore, error)

NewMmapEdgeStore creates a new mmap edge store.

type MmapObjectStore

type MmapObjectStore = libhprof.MmapObjectStore

MmapObjectStore provides memory-mapped storage for object metadata.

func NewMmapObjectStore

func NewMmapObjectStore(estimatedObjects int, config MmapConfig) (*MmapObjectStore, error)

NewMmapObjectStore creates a new mmap object store.

type ObjectArrayAnalysisStrategy

type ObjectArrayAnalysisStrategy = libhprof.ObjectArrayAnalysisStrategy

ObjectArrayAnalysisStrategy analyzes Object[] references.

type ObjectArrayRefInfo

type ObjectArrayRefInfo = libhprof.ObjectArrayRefInfo

ObjectArrayRefInfo holds information about Object[] references.

type ObjectField

type ObjectField = libhprof.ObjectField

ObjectField represents a field value in an object.

type ObjectFieldDetail

type ObjectFieldDetail = libhprof.ObjectFieldDetail

ObjectFieldDetail represents a field with detailed information for tree expansion.

type ObjectInfo

type ObjectInfo = libhprof.ObjectInfo

ObjectInfo holds information about a specific object.

type ObjectRecord

type ObjectRecord = libhprof.ObjectRecord

ObjectRecord represents an object in mmap storage.

type ObjectReference

type ObjectReference = libhprof.ObjectReference

ObjectReference represents a reference from one object to another.

type ParallelAnalyzer

type ParallelAnalyzer = libhprof.ParallelAnalyzer

ParallelAnalyzer runs analysis tasks in parallel.

func NewParallelAnalyzer

func NewParallelAnalyzer(refGraph *ReferenceGraph, config ParallelConfig) *ParallelAnalyzer

NewParallelAnalyzer creates a new parallel analyzer.

type ParallelBFSResult

type ParallelBFSResult = libhprof.ParallelBFSResult

ParallelBFSResult holds the result of parallel BFS traversal.

func ParallelBFSFromRoots

func ParallelBFSFromRoots(
	g *ReferenceGraph,
	roots []uint64,
	maxDepth int,
	getNeighbors func(objID uint64) []uint64,
) ParallelBFSResult

ParallelBFSFromRoots performs BFS from multiple roots in parallel.

type ParallelConfig

type ParallelConfig = libhprof.ParallelConfig

ParallelConfig configures parallel analysis behavior.

func DefaultParallelConfig

func DefaultParallelConfig() ParallelConfig

DefaultParallelConfig returns default parallel configuration.

type ParallelRetainedSizeComputer

type ParallelRetainedSizeComputer = libhprof.ParallelRetainedSizeComputer

ParallelRetainedSizeComputer computes retained sizes in parallel.

func NewParallelRetainedSizeComputer

func NewParallelRetainedSizeComputer(state *LevelDominatorState, config HierarchicalDominatorConfig) *ParallelRetainedSizeComputer

NewParallelRetainedSizeComputer creates a new parallel retained size computer.

type Parser

type Parser = libhprof.Parser

Parser parses HPROF heap dump files.

func NewParser

func NewParser(opts *ParserOptions) *Parser

NewParser creates a new HPROF parser.

type ParserOptions

type ParserOptions = libhprof.ParserOptions

ParserOptions configures the HPROF parser.

func DefaultParserOptions

func DefaultParserOptions() *ParserOptions

DefaultParserOptions returns default parser options.

type PathNode

type PathNode = libhprof.PathNode

PathNode represents a node in a reference path from GC Root to object.

type PoolConfig

type PoolConfig = libhprof.PoolConfig

PoolConfig is an alias to perflib hprof PoolConfig.

func DefaultPoolConfig

func DefaultPoolConfig() PoolConfig

DefaultPoolConfig returns a default pool configuration.

type PoolMetrics

type PoolMetrics = libhprof.PoolMetrics

PoolMetrics is an alias to perflib hprof PoolMetrics.

type ProgressTracker

type ProgressTracker = libhprof.ProgressTracker

ProgressTracker is an alias to perflib hprof ProgressTracker.

func NewProgressTracker

func NewProgressTracker(total int64, callback func(completed, total int64), interval time.Duration) *ProgressTracker

NewProgressTracker creates a new progress tracker.

type QueueItem

type QueueItem = libhprof.QueueItem

QueueItem represents an item in the BFS queue.

type Reader

type Reader = libhprof.Reader

Reader provides buffered reading of HPROF binary data.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader creates a new HPROF reader.

type RecordTag

type RecordTag = libhprof.RecordTag

RecordTag represents the type of record in HPROF format.

type ReferenceGraph

type ReferenceGraph = libhprof.ReferenceGraph

ReferenceGraph holds the object reference graph with GC root tracking.

func DeserializeReferenceGraph

func DeserializeReferenceGraph(data []byte) (*ReferenceGraph, error)

DeserializeReferenceGraph deserializes a ReferenceGraph from compressed protobuf bytes.

func DeserializeReferenceGraphFromFile

func DeserializeReferenceGraphFromFile(filename string) (*ReferenceGraph, error)

DeserializeReferenceGraphFromFile deserializes a ReferenceGraph from a file.

func NewReferenceGraph

func NewReferenceGraph() *ReferenceGraph

NewReferenceGraph creates a new reference graph.

func NewReferenceGraphWithCapacity

func NewReferenceGraphWithCapacity(estimatedObjects int) *ReferenceGraph

NewReferenceGraphWithCapacity creates a new reference graph with pre-allocated capacity.

type ReferenceGraphData

type ReferenceGraphData = libhprof.ReferenceGraphData

ReferenceGraphData holds data for reference graph visualization.

type ReferenceGraphEdge

type ReferenceGraphEdge = libhprof.ReferenceGraphEdge

ReferenceGraphEdge represents an edge in the reference graph visualization.

type ReferenceGraphNode

type ReferenceGraphNode = libhprof.ReferenceGraphNode

ReferenceGraphNode represents a node in the reference graph visualization.

type ResultBuilder

type ResultBuilder = libhprof.ResultBuilder

ResultBuilder builds the final HeapAnalysisResult from parsed state.

type RetainedSizeAnalysisResult

type RetainedSizeAnalysisResult = libhprof.RetainedSizeAnalysisResult

RetainedSizeAnalysisResult holds the complete analysis result.

type RetainedSizeAnalyzer

type RetainedSizeAnalyzer = libhprof.RetainedSizeAnalyzer

RetainedSizeAnalyzer analyzes retained size discrepancies between different calculation methods.

func NewRetainedSizeAnalyzer

func NewRetainedSizeAnalyzer(refGraph *ReferenceGraph) *RetainedSizeAnalyzer

NewRetainedSizeAnalyzer creates a new analyzer with default configuration.

func NewRetainedSizeAnalyzerWithConfig

func NewRetainedSizeAnalyzerWithConfig(refGraph *ReferenceGraph, config *AnalyzerConfig) *RetainedSizeAnalyzer

NewRetainedSizeAnalyzerWithConfig creates a new analyzer with custom configuration.

type RetainedSizeCalculator

type RetainedSizeCalculator = libhprof.RetainedSizeCalculator

RetainedSizeCalculator defines the interface for retained size calculation strategies.

type RetainedSizeCalculatorRegistry

type RetainedSizeCalculatorRegistry = libhprof.RetainedSizeCalculatorRegistry

RetainedSizeCalculatorRegistry manages available retained size calculators.

func NewRetainedSizeCalculatorRegistry

func NewRetainedSizeCalculatorRegistry() *RetainedSizeCalculatorRegistry

NewRetainedSizeCalculatorRegistry creates a new registry with default calculators.

type RetainedSizeContext

type RetainedSizeContext = libhprof.RetainedSizeContext

RetainedSizeContext provides read-only access to graph data needed for retained size calculation.

type RetainedSizeStrategy

type RetainedSizeStrategy = libhprof.RetainedSizeStrategy

RetainedSizeStrategy defines the strategy for retained size calculation.

type RetainerBFSContext

type RetainerBFSContext = libhprof.RetainerBFSContext

RetainerBFSContext holds context for retainer BFS traversal.

func NewRetainerBFSContext

func NewRetainerBFSContext(maxObjects, maxRetainerKeys int) *RetainerBFSContext

NewRetainerBFSContext creates a new retainer BFS context.

type RetainerBFSContextPool

type RetainerBFSContextPool = libhprof.RetainerBFSContextPool

RetainerBFSContextPool manages a pool of retainer BFS contexts.

func NewRetainerBFSContextPool

func NewRetainerBFSContextPool(maxObjects, maxRetainerKeys int) *RetainerBFSContextPool

NewRetainerBFSContextPool creates a new retainer BFS context pool.

type RetainerInfo

type RetainerInfo = libhprof.RetainerInfo

RetainerInfo describes what retains a class's instances.

type RetainerResult

type RetainerResult = libhprof.RetainerResult

RetainerResult holds the result of retainer analysis.

type SamplingConfig

type SamplingConfig = libhprof.SamplingConfig

SamplingConfig controls how sampling is performed for large datasets.

func DefaultSamplingConfig

func DefaultSamplingConfig() SamplingConfig

DefaultSamplingConfig returns the default sampling configuration.

type ScenarioComparisonStrategy

type ScenarioComparisonStrategy = libhprof.ScenarioComparisonStrategy

ScenarioComparisonStrategy compares different retained size calculation scenarios.

type SerializationStats

type SerializationStats = libhprof.SerializationStats

SerializationStats holds statistics about the serialization process.

func EnsureSerializationComplete

func EnsureSerializationComplete(filename string, timeout time.Duration) (*SerializationStats, error)

EnsureSerializationComplete waits for any pending background serialization to complete.

type SerializeOptions

type SerializeOptions = libhprof.SerializeOptions

SerializeOptions controls serialization behavior.

func DefaultSerializeOptions

func DefaultSerializeOptions() SerializeOptions

DefaultSerializeOptions returns default serialization options.

func FastSerializeOptions

func FastSerializeOptions() SerializeOptions

FastSerializeOptions returns options optimized for speed.

func LegacySerializeOptions

func LegacySerializeOptions() SerializeOptions

LegacySerializeOptions returns options compatible with older versions (gzip).

type SizeCalculationMode

type SizeCalculationMode = libhprof.SizeCalculationMode

SizeCalculationMode defines how shallow sizes are calculated.

type StandardRetainedSizeCalculator

type StandardRetainedSizeCalculator = libhprof.StandardRetainedSizeCalculator

StandardRetainedSizeCalculator implements strict dominator-tree based calculation.

type StaticFieldInfo

type StaticFieldInfo = libhprof.StaticFieldInfo

StaticFieldInfo describes a static field with its value.

type StrategyResult

type StrategyResult = libhprof.StrategyResult

StrategyResult holds the result of a strategy analysis.

type StringStats

type StringStats = libhprof.StringStats

StringStats holds string-related statistics.

type Task

type Task[T any, R any] = libhprof.Task[T, R]

Task is an alias to perflib hprof Task.

type TaskFunc

type TaskFunc[T any, R any] = libhprof.TaskFunc[T, R]

TaskFunc is an alias to perflib hprof TaskFunc.

func NewTask

func NewTask[T any, R any](input T, fn func(ctx context.Context, input T) (R, error)) *TaskFunc[T, R]

NewTask creates a new task from a function.

type TaskResult

type TaskResult[T any, R any] = libhprof.TaskResult[T, R]

TaskResult is an alias to perflib hprof TaskResult.

type VersionedBitset

type VersionedBitset = libhprof.VersionedBitset

VersionedBitset is an alias to perflib hprof VersionedBitset.

func NewVersionedBitset

func NewVersionedBitset(size int) *VersionedBitset

NewVersionedBitset creates a new versioned bitset.

type WorkerPool

type WorkerPool[T any, R any] = libhprof.WorkerPool[T, R]

WorkerPool is an alias to perflib hprof WorkerPool.

func NewWorkerPool

func NewWorkerPool[T any, R any](config PoolConfig) *WorkerPool[T, R]

NewWorkerPool creates a new worker pool with the given configuration.

type ZstdCompressor

type ZstdCompressor = libhprof.ZstdCompressor

ZstdCompressor is an alias to perflib hprof ZstdCompressor.

func NewZstdCompressor

func NewZstdCompressor(level CompressionLevel) (*ZstdCompressor, error)

NewZstdCompressor creates a new zstd compressor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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