Documentation
¶
Overview ¶
Package model defines output data abstractions for different analysis types. This is the library-clean model package without business-specific dependencies.
Package model defines output data abstractions for different analysis types.
Package model defines output data abstractions for different analysis types.
Package model defines output data abstractions for different analysis types.
Package model defines output data abstractions for different analysis types.
Package model defines output data abstractions for different analysis types.
Package model defines output data abstractions for different analysis types.
Index ¶
- func AnalysisModeString(profiler Profiler, event EventType) string
- func MarshalAnalysisData(data AnalysisData) ([]byte, error)
- type AllocationData
- type AnalysisData
- type AnalysisDataType
- type AnalysisRequest
- type AnalysisResponse
- type CPUProfilingData
- type CallStackInfo
- type EventType
- type GCRootPath
- type GCRootPathNode
- type GoroutineGroup
- type HeapAnalysisData
- type HeapBiggestObject
- type HeapBusinessRetainer
- type HeapClassStats
- type HeapGCRootClass
- type HeapGCRootInstance
- type HeapGCRootPath
- type HeapGCRootPathNode
- type HeapGCRootsData
- type HeapGCRootsSummary
- type HeapObjectField
- type HeapReferenceEdge
- type HeapReferenceGraph
- type HeapReferenceNode
- type HeapRetainer
- type LeakInfo
- type MemoryLeakData
- type OutputFile
- type PProfBatchData
- type PProfBatchProfileSet
- type PProfBlockData
- type PProfCPUData
- type PProfGoroutineData
- type PProfHeapData
- type PProfHeapSummary
- type PProfLeakGrowthItem
- type PProfLeakReport
- type PProfLeakReportSummary
- type PProfMemoryStats
- type PProfTopFunc
- type ParseResult
- type Profiler
- type ResourceType
- type Sample
- type SuggestionItem
- type ThreadInfo
- type TopFuncValue
- type TopFuncsMap
- type TopFunction
- type TopItem
- type TracingData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalysisModeString ¶
AnalysisMode returns the composite mode string "{profiler}-{event}".
func MarshalAnalysisData ¶
func MarshalAnalysisData(data AnalysisData) ([]byte, error)
MarshalAnalysisData marshals AnalysisData into type-discriminated JSON.
Types ¶
type AllocationData ¶
type AllocationData struct {
FlameGraphFile string `json:"flamegraph_file"`
CallGraphFile string `json:"callgraph_file"`
ThreadStats []ThreadInfo `json:"thread_stats"`
TopAllocators TopFuncsMap `json:"top_allocators"`
TotalAllocations int64 `json:"total_allocations"`
TotalBytes int64 `json:"total_bytes,omitempty"`
}
AllocationData holds memory allocation analysis data.
func (*AllocationData) Summary ¶
func (d *AllocationData) Summary() map[string]interface{}
Summary returns a summary of the allocation analysis.
func (*AllocationData) TopItems ¶
func (d *AllocationData) TopItems() []TopItem
TopItems returns the top allocators from allocation analysis.
func (*AllocationData) Type ¶
func (d *AllocationData) Type() AnalysisDataType
Type returns the analysis data type.
type AnalysisData ¶
type AnalysisData interface {
// Type returns the analysis data type.
Type() AnalysisDataType
// Summary returns a summary of the analysis as key-value pairs.
Summary() map[string]interface{}
// TopItems returns the top items (functions, classes, etc.) from the analysis.
TopItems() []TopItem
}
AnalysisData is the interface for all analysis data types. Different analysis types implement this interface to provide type-specific data while maintaining a common abstraction.
func UnmarshalAnalysisData ¶
func UnmarshalAnalysisData(data []byte) (AnalysisData, error)
UnmarshalAnalysisData unmarshals JSON into the appropriate AnalysisData type.
type AnalysisDataType ¶
type AnalysisDataType string
AnalysisDataType represents the type of analysis data.
const ( DataTypeCPUProfiling AnalysisDataType = "cpu_profiling" DataTypeAllocation AnalysisDataType = "allocation" DataTypeHeapDump AnalysisDataType = "heap_dump" DataTypeMemoryLeak AnalysisDataType = "memory_leak" DataTypeTracing AnalysisDataType = "tracing" DataTypePProfCPU AnalysisDataType = "pprof_cpu" DataTypePProfHeap AnalysisDataType = "pprof_heap" DataTypePProfGoroutine AnalysisDataType = "pprof_goroutine" DataTypePProfBlock AnalysisDataType = "pprof_block" DataTypePProfMutex AnalysisDataType = "pprof_mutex" DataTypePProfBatch AnalysisDataType = "pprof_batch" )
type AnalysisRequest ¶
type AnalysisRequest struct {
// Mode is the analysis mode (e.g., "async-profiler-cpu", "pprof-heap").
Mode string
// InputFile is the path to the input profiling data file or directory.
InputFile string
// OutputDir is the directory where analysis output files will be written.
OutputDir string
// Options holds optional analysis parameters.
Options map[string]interface{}
}
AnalysisRequest represents a request to analyze profiling data. This is the library-clean version without business-specific fields (no TaskID, COSBucket, MasterTaskTID, RequestParams).
type AnalysisResponse ¶
type AnalysisResponse struct {
Mode string `json:"mode"`
TotalRecords int `json:"total_records"`
OutputFiles []OutputFile `json:"output_files"`
Data AnalysisData `json:"data"`
Suggestions []SuggestionItem `json:"suggestions"`
Error string `json:"error,omitempty"`
}
AnalysisResponse represents the response from an analysis.
type CPUProfilingData ¶
type CPUProfilingData struct {
FlameGraphFile string `json:"flamegraph_file"`
CallGraphFile string `json:"callgraph_file"`
ThreadStats []ThreadInfo `json:"thread_stats"`
TopFuncs TopFuncsMap `json:"top_funcs"`
TotalSamples int64 `json:"total_samples"`
}
CPUProfilingData holds CPU profiling analysis data.
func (*CPUProfilingData) Summary ¶
func (d *CPUProfilingData) Summary() map[string]interface{}
Summary returns a summary of the CPU profiling analysis.
func (*CPUProfilingData) TopItems ¶
func (d *CPUProfilingData) TopItems() []TopItem
TopItems returns the top functions from CPU profiling.
func (*CPUProfilingData) Type ¶
func (d *CPUProfilingData) Type() AnalysisDataType
Type returns the analysis data type.
type CallStackInfo ¶
type CallStackInfo struct {
FunctionName string `json:"func"`
CallStacks []string `json:"callstacks"`
Count int `json:"count"`
}
CallStackInfo holds call stack information for a top function.
type EventType ¶
type EventType string
EventType represents the type of profiling event.
const ( // EventCPU is CPU sampling event. EventCPU EventType = "cpu" // EventAlloc is memory allocation event. EventAlloc EventType = "alloc" // EventHeap is heap snapshot event. EventHeap EventType = "heap" // EventWall is wall-clock time event. EventWall EventType = "wall" // EventLock is lock contention event. EventLock EventType = "lock" // EventGoroutine is Go goroutine profiling event. EventGoroutine EventType = "goroutine" // EventBlock is Go block profiling event. EventBlock EventType = "block" // EventMutex is Go mutex profiling event. EventMutex EventType = "mutex" // EventIO is IO tracing event. EventIO EventType = "io" )
type GCRootPath ¶
type GCRootPath struct {
RootType string `json:"root_type"`
Path []*GCRootPathNode `json:"path"`
Depth int `json:"depth"`
}
GCRootPath represents a path from GC Root to an object.
type GCRootPathNode ¶
type GCRootPathNode struct {
ClassName string `json:"class_name"`
FieldName string `json:"field_name,omitempty"`
Size int64 `json:"size"`
}
GCRootPathNode represents a node in a GC root path.
type GoroutineGroup ¶
type GoroutineGroup struct {
Count int64 `json:"count"`
Percentage float64 `json:"percentage"`
State string `json:"state,omitempty"`
TopFunc string `json:"top_func"`
Stack []string `json:"stack,omitempty"`
}
GoroutineGroup represents a group of goroutines with the same stack.
type HeapAnalysisData ¶
type HeapAnalysisData struct {
HeapReportFile string `json:"heap_report_file"`
HistogramFile string `json:"histogram_file"`
Format string `json:"format,omitempty"`
IDSize int `json:"id_size,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
TotalClasses int `json:"total_classes"`
TotalInstances int64 `json:"total_instances"`
TotalHeapSize int64 `json:"total_heap_size"`
HeapSizeHuman string `json:"heap_size_human"`
LiveBytes int64 `json:"live_bytes,omitempty"`
LiveObjects int64 `json:"live_objects,omitempty"`
TopClasses []HeapClassStats `json:"top_classes"`
BiggestObjects []HeapBiggestObject `json:"biggest_objects,omitempty"`
ReferenceGraphs map[string]*HeapReferenceGraph `json:"reference_graphs,omitempty"`
BusinessRetainers map[string][]HeapBusinessRetainer `json:"business_retainers,omitempty"`
}
HeapAnalysisData holds Java heap dump analysis data.
func (*HeapAnalysisData) Summary ¶
func (d *HeapAnalysisData) Summary() map[string]interface{}
Summary returns a summary of the heap analysis.
func (*HeapAnalysisData) TopItems ¶
func (d *HeapAnalysisData) TopItems() []TopItem
TopItems returns the top classes from heap analysis.
func (*HeapAnalysisData) Type ¶
func (d *HeapAnalysisData) Type() AnalysisDataType
Type returns the analysis data type.
type HeapBiggestObject ¶
type HeapBiggestObject struct {
ObjectID string `json:"object_id"`
ClassName string `json:"class_name"`
ShallowSize int64 `json:"shallow_size"`
RetainedSize int64 `json:"retained_size"`
Fields []HeapObjectField `json:"fields,omitempty"`
GCRootPath *HeapGCRootPath `json:"gc_root_path,omitempty"`
}
HeapBiggestObject represents a large object with its details.
type HeapBusinessRetainer ¶
type HeapBusinessRetainer struct {
ClassName string `json:"class_name"`
FieldPath []string `json:"field_path"`
RetainedSize int64 `json:"retained_size"`
RetainedCount int64 `json:"retained_count"`
Percentage float64 `json:"percentage"`
Depth int `json:"depth"`
IsGCRoot bool `json:"is_gc_root"`
GCRootType string `json:"gc_root_type,omitempty"`
}
HeapBusinessRetainer represents a business-level class that retains memory.
type HeapClassStats ¶
type HeapClassStats struct {
ClassName string `json:"class_name"`
InstanceCount int64 `json:"instance_count"`
TotalSize int64 `json:"total_size"`
Percentage float64 `json:"percentage"`
RetainedSize int64 `json:"retained_size,omitempty"`
Retainers []HeapRetainer `json:"retainers,omitempty"`
GCRootPaths []*GCRootPath `json:"gc_root_paths,omitempty"`
}
HeapClassStats holds statistics for a single class in heap analysis.
type HeapGCRootClass ¶
type HeapGCRootClass struct {
ClassName string `json:"class_name"`
RootType string `json:"root_type,omitempty"`
TotalShallow int64 `json:"total_shallow"`
TotalRetained int64 `json:"total_retained"`
InstanceCount int `json:"instance_count"`
Roots []HeapGCRootInstance `json:"roots,omitempty"`
}
HeapGCRootClass represents GC roots grouped by class name (like IDEA).
type HeapGCRootInstance ¶
type HeapGCRootInstance struct {
ObjectID string `json:"object_id"`
RootType string `json:"root_type"`
ShallowSize int64 `json:"shallow_size"`
RetainedSize int64 `json:"retained_size"`
ThreadID string `json:"thread_id,omitempty"`
FrameIndex int `json:"frame_index,omitempty"`
}
HeapGCRootInstance represents a single GC root instance.
type HeapGCRootPath ¶
type HeapGCRootPath struct {
RootType string `json:"root_type"`
Path []HeapGCRootPathNode `json:"path"`
Depth int `json:"depth"`
}
HeapGCRootPath represents a path from GC Root to an object.
type HeapGCRootPathNode ¶
type HeapGCRootPathNode struct {
ClassName string `json:"class_name"`
FieldName string `json:"field_name,omitempty"`
Size int64 `json:"size"`
}
HeapGCRootPathNode represents a node in a GC root path.
type HeapGCRootsData ¶
type HeapGCRootsData struct {
Summary HeapGCRootsSummary `json:"summary"`
Classes []HeapGCRootClass `json:"classes"`
}
HeapGCRootsData holds GC roots analysis data for persistence. This is written to gc_roots.json during analysis for fast loading in serve mode.
type HeapGCRootsSummary ¶
type HeapGCRootsSummary struct {
TotalRoots int `json:"total_roots"`
TotalClasses int `json:"total_classes"`
TotalRetained int64 `json:"total_retained"`
TotalShallow int64 `json:"total_shallow"`
}
HeapGCRootsSummary holds summary statistics for GC roots.
type HeapObjectField ¶
type HeapObjectField struct {
Name string `json:"name"`
Type string `json:"type"`
Value interface{} `json:"value,omitempty"`
RefID string `json:"ref_id,omitempty"`
RefClass string `json:"ref_class,omitempty"`
ShallowSize int64 `json:"shallow_size,omitempty"`
RetainedSize int64 `json:"retained_size,omitempty"`
HasChildren bool `json:"has_children,omitempty"`
IsStatic bool `json:"is_static,omitempty"`
}
HeapObjectField represents a field value in an object.
type HeapReferenceEdge ¶
type HeapReferenceEdge struct {
Source string `json:"source"`
Target string `json:"target"`
FieldName string `json:"field_name,omitempty"`
}
HeapReferenceEdge represents an edge in the reference graph visualization.
type HeapReferenceGraph ¶
type HeapReferenceGraph struct {
ClassName string `json:"class_name"`
Nodes []HeapReferenceNode `json:"nodes"`
Edges []HeapReferenceEdge `json:"edges"`
}
HeapReferenceGraph represents the reference graph for a class.
type HeapReferenceNode ¶
type HeapReferenceNode struct {
ID string `json:"id"`
ClassName string `json:"class_name"`
Size int64 `json:"size"`
RetainedSize int64 `json:"retained_size"`
IsGCRoot bool `json:"is_gc_root"`
GCRootType string `json:"gc_root_type,omitempty"`
}
HeapReferenceNode represents a node in the reference graph visualization.
type HeapRetainer ¶
type HeapRetainer struct {
RetainerClass string `json:"retainer_class"`
FieldName string `json:"field_name,omitempty"`
RetainedSize int64 `json:"retained_size"`
RetainedCount int64 `json:"retained_count"`
Percentage float64 `json:"percentage"`
Depth int `json:"depth,omitempty"`
}
HeapRetainer describes what retains instances of a class.
type LeakInfo ¶
type LeakInfo struct {
Location string `json:"location"`
LeakBytes int64 `json:"leak_bytes"`
LeakCount int64 `json:"leak_count"`
Percentage float64 `json:"percentage"`
Description string `json:"description,omitempty"`
}
LeakInfo holds information about a potential memory leak.
type MemoryLeakData ¶
type MemoryLeakData struct {
LeakReportFile string `json:"leak_report_file"`
AllocationFile string `json:"allocation_file"`
LeakSuspects []LeakInfo `json:"leak_suspects"`
TopAllocators TopFuncsMap `json:"top_allocators"`
TotalLeakBytes int64 `json:"total_leak_bytes"`
TotalLeakCount int64 `json:"total_leak_count"`
ThreadStats []ThreadInfo `json:"thread_stats,omitempty"`
}
MemoryLeakData holds memory leak analysis data.
func (*MemoryLeakData) Summary ¶
func (d *MemoryLeakData) Summary() map[string]interface{}
Summary returns a summary of the memory leak analysis.
func (*MemoryLeakData) TopItems ¶
func (d *MemoryLeakData) TopItems() []TopItem
TopItems returns the top leak suspects.
func (*MemoryLeakData) Type ¶
func (d *MemoryLeakData) Type() AnalysisDataType
Type returns the analysis data type.
type OutputFile ¶
type OutputFile struct {
Name string `json:"name"` // Descriptive name (e.g., "Flame Graph", "Heap Report")
LocalPath string `json:"local_path"` // Local file path
RelativePath string `json:"relative_path,omitempty"` // Relative path within output directory
COSKey string `json:"cos_key,omitempty"` // Deprecated: Object storage key, retained for backward compatibility
ContentType string `json:"content_type"` // MIME type
}
OutputFile describes an output file generated by analysis.
type PProfBatchData ¶
type PProfBatchData struct {
ProfileSets map[string]*PProfBatchProfileSet `json:"profile_sets"`
LeakReports map[string]*PProfLeakReportSummary `json:"leak_reports,omitempty"`
DetailedLeakReports map[string]*PProfLeakReport `json:"detailed_leak_reports,omitempty"`
TopFuncs []PProfTopFunc `json:"top_funcs,omitempty"`
TotalSamples int64 `json:"total_samples"`
}
PProfBatchData holds Go pprof batch analysis data (pprof-all mode).
func (*PProfBatchData) Summary ¶
func (d *PProfBatchData) Summary() map[string]interface{}
Summary returns a summary of the pprof batch analysis.
func (*PProfBatchData) TopItems ¶
func (d *PProfBatchData) TopItems() []TopItem
TopItems returns the top functions from pprof batch analysis.
func (*PProfBatchData) Type ¶
func (d *PProfBatchData) Type() AnalysisDataType
Type returns the analysis data type.
type PProfBatchProfileSet ¶
type PProfBatchProfileSet struct {
ProfileType string `json:"profile_type"`
FileCount int `json:"file_count"`
TotalSamples int64 `json:"total_samples"`
LatestFile string `json:"latest_file"`
}
PProfBatchProfileSet represents analysis results for a set of profiles.
type PProfBlockData ¶
type PProfBlockData struct {
TotalDelay int64 `json:"total_delay"`
TotalCount int64 `json:"total_count"`
Unit string `json:"unit"`
TopFuncs []PProfTopFunc `json:"top_funcs"`
FlameGraphFile string `json:"flamegraph_file,omitempty"`
}
PProfBlockData holds Go pprof Block/Mutex analysis data.
func (*PProfBlockData) Summary ¶
func (d *PProfBlockData) Summary() map[string]interface{}
Summary returns a summary of the pprof Block analysis.
func (*PProfBlockData) TopItems ¶
func (d *PProfBlockData) TopItems() []TopItem
TopItems returns the top functions from pprof Block analysis.
func (*PProfBlockData) Type ¶
func (d *PProfBlockData) Type() AnalysisDataType
Type returns the analysis data type.
type PProfCPUData ¶
type PProfCPUData struct {
FlameGraphFile string `json:"flamegraph_file"`
CallGraphFile string `json:"callgraph_file,omitempty"`
Duration int64 `json:"duration_ns"`
TotalSamples int64 `json:"total_samples"`
SampleUnit string `json:"sample_unit"`
TopFuncs []PProfTopFunc `json:"top_funcs"`
TopFuncsByFlat []PProfTopFunc `json:"top_funcs_by_flat,omitempty"`
TopFuncsByCum []PProfTopFunc `json:"top_funcs_by_cum,omitempty"`
}
PProfCPUData holds Go pprof CPU analysis data.
func (*PProfCPUData) Summary ¶
func (d *PProfCPUData) Summary() map[string]interface{}
Summary returns a summary of the pprof CPU analysis.
func (*PProfCPUData) TopItems ¶
func (d *PProfCPUData) TopItems() []TopItem
TopItems returns the top functions from pprof CPU analysis.
func (*PProfCPUData) Type ¶
func (d *PProfCPUData) Type() AnalysisDataType
Type returns the analysis data type.
type PProfGoroutineData ¶
type PProfGoroutineData struct {
TotalCount int64 `json:"total_count"`
Distribution []GoroutineGroup `json:"distribution"`
TopFuncs []PProfTopFunc `json:"top_funcs"`
FlameGraphFile string `json:"flamegraph_file,omitempty"`
}
PProfGoroutineData holds Go pprof Goroutine analysis data.
func (*PProfGoroutineData) Summary ¶
func (d *PProfGoroutineData) Summary() map[string]interface{}
Summary returns a summary of the pprof Goroutine analysis.
func (*PProfGoroutineData) TopItems ¶
func (d *PProfGoroutineData) TopItems() []TopItem
TopItems returns the top functions from pprof Goroutine analysis.
func (*PProfGoroutineData) Type ¶
func (d *PProfGoroutineData) Type() AnalysisDataType
Type returns the analysis data type.
type PProfHeapData ¶
type PProfHeapData struct {
InuseSpace *PProfMemoryStats `json:"inuse_space"`
InuseObjects *PProfMemoryStats `json:"inuse_objects"`
AllocSpace *PProfMemoryStats `json:"alloc_space"`
AllocObjects *PProfMemoryStats `json:"alloc_objects"`
FlameGraphFiles map[string]string `json:"flamegraph_files"`
HeapSummary *PProfHeapSummary `json:"summary"`
}
PProfHeapData holds Go pprof Heap analysis data.
func (*PProfHeapData) Summary ¶
func (d *PProfHeapData) Summary() map[string]interface{}
Summary returns a summary of the pprof Heap analysis.
func (*PProfHeapData) TopItems ¶
func (d *PProfHeapData) TopItems() []TopItem
TopItems returns the top functions from pprof Heap analysis (by inuse_space).
func (*PProfHeapData) Type ¶
func (d *PProfHeapData) Type() AnalysisDataType
Type returns the analysis data type.
type PProfHeapSummary ¶
type PProfHeapSummary struct {
TotalInuseBytes int64 `json:"total_inuse_bytes"`
TotalInuseObjects int64 `json:"total_inuse_objects"`
TotalAllocBytes int64 `json:"total_alloc_bytes"`
TotalAllocObjects int64 `json:"total_alloc_objects"`
}
PProfHeapSummary holds summary statistics for heap analysis.
type PProfLeakGrowthItem ¶
type PProfLeakGrowthItem struct {
Name string `json:"name"`
BaselineValue int64 `json:"baseline_value"`
CurrentValue int64 `json:"current_value"`
GrowthValue int64 `json:"growth_value"`
GrowthPercent float64 `json:"growth_percent"`
}
PProfLeakGrowthItem represents a single growth item in leak detection.
type PProfLeakReport ¶
type PProfLeakReport struct {
Type string `json:"type"`
Severity string `json:"severity"`
Conclusion string `json:"conclusion"`
BaselineTotal int64 `json:"baseline_total"`
CurrentTotal int64 `json:"current_total"`
TotalGrowth int64 `json:"total_growth"`
TotalGrowthPercent float64 `json:"total_growth_percent"`
GrowthItems []PProfLeakGrowthItem `json:"growth_items,omitempty"`
}
PProfLeakReport represents a detailed leak detection report.
type PProfLeakReportSummary ¶
type PProfLeakReportSummary struct {
Type string `json:"type"`
Severity string `json:"severity"`
Conclusion string `json:"conclusion"`
TotalGrowth int64 `json:"total_growth"`
GrowthPercent float64 `json:"growth_percent"`
ItemsCount int `json:"items_count"`
}
PProfLeakReportSummary represents a summary of leak detection.
type PProfMemoryStats ¶
type PProfMemoryStats struct {
Total int64 `json:"total"`
Unit string `json:"unit"`
TopFuncs []PProfTopFunc `json:"top_funcs"`
TopNCount int `json:"top_n_count"`
}
PProfMemoryStats holds memory statistics for a specific sample type.
type PProfTopFunc ¶
type PProfTopFunc struct {
Name string `json:"name"`
Flat int64 `json:"flat"`
FlatPct float64 `json:"flat_pct"`
Cum int64 `json:"cum"`
CumPct float64 `json:"cum_pct"`
Module string `json:"module,omitempty"`
SourceFile string `json:"source_file,omitempty"`
SourceLine int `json:"source_line,omitempty"`
}
PProfTopFunc represents a top function in pprof analysis.
type ParseResult ¶
type ParseResult struct {
Samples []*Sample `json:"samples"`
TotalSamples int64 `json:"total_samples"`
ThreadStats map[string]*ThreadInfo `json:"thread_stats"`
TopFuncs TopFuncsMap `json:"top_funcs"`
TopFuncsCallstacks map[string]*CallStackInfo `json:"top_funcs_callstacks,omitempty"`
Suggestions []SuggestionItem `json:"suggestions,omitempty"`
}
ParseResult holds the result of parsing profiling data.
type Profiler ¶
type Profiler string
Profiler represents the profiling tool used to collect data.
const ( // ProfilerPerf is the Linux perf profiler. ProfilerPerf Profiler = "perf" // ProfilerAsyncProfiler is the async-profiler for Java. ProfilerAsyncProfiler Profiler = "async-profiler" // ProfilerPProf is the Go pprof profiler. ProfilerPProf Profiler = "pprof" // ProfilerHeapDump is the Java heap dump tool. ProfilerHeapDump Profiler = "heapdump" // ProfilerJeprof is the jemalloc profiler. ProfilerJeprof Profiler = "jeprof" )
type ResourceType ¶
type ResourceType string
ResourceType represents the resource category that an analysis mode targets.
const ( // ResourceCPU is CPU-related profiling. ResourceCPU ResourceType = "CPU" // ResourceMemory is memory-related profiling. ResourceMemory ResourceType = "Memory" // ResourceIO is disk/IO-related profiling. ResourceIO ResourceType = "Disk" // ResourceApp is application-level profiling (e.g. Java wall/lock). ResourceApp ResourceType = "App" // ResourceGoroutine is Go goroutine profiling. ResourceGoroutine ResourceType = "Goroutine" // ResourceConcurrency is concurrency-related profiling (block, mutex). ResourceConcurrency ResourceType = "Concurrency" )
type Sample ¶
type Sample struct {
ThreadName string `json:"thread_name"`
TID int `json:"tid,omitempty"`
CallStack []string `json:"callstack"`
Value int64 `json:"value"`
}
Sample represents a single profiling sample.
type SuggestionItem ¶
type SuggestionItem struct {
Type string `json:"type,omitempty"`
Severity string `json:"severity,omitempty"`
Suggestion string `json:"suggestion"`
FuncName string `json:"func,omitempty"`
Namespace string `json:"namespace,omitempty"`
CallStack json.RawMessage `json:"callstack,omitempty"`
AISuggestion string `json:"ai_suggestion,omitempty"`
}
SuggestionItem represents a single suggestion from analysis. This is the library-clean version without DB tags or business fields.
type ThreadInfo ¶
type ThreadInfo struct {
TID int `json:"tid"`
ThreadName string `json:"thread_name"`
Samples int64 `json:"samples"`
Percentage float64 `json:"percentage"`
}
ThreadInfo represents information about a thread.
type TopFuncValue ¶
TopFuncValue holds the value for a top function entry.
type TopFuncsMap ¶
type TopFuncsMap map[string]TopFuncValue
TopFuncsMap is a map of function name to its sample count/percentage.
type TopFunction ¶
type TopFunction struct {
Name string `json:"name"`
Module string `json:"module,omitempty"`
SelfSamples int64 `json:"self"`
SelfPercent float64 `json:"self_pct"`
TotalSamples int64 `json:"total,omitempty"`
TotalPercent float64 `json:"total_pct,omitempty"`
}
TopFunction represents a hot function with its statistics.
type TopItem ¶
type TopItem struct {
Name string `json:"name"`
Value int64 `json:"value"` // Sample count / bytes / instance count
Percentage float64 `json:"percentage"` // Percentage of total
Extra map[string]interface{} `json:"extra,omitempty"`
}
TopItem represents a generic top item (function/class/object).
type TracingData ¶
type TracingData struct {
FlameGraphFile string `json:"flamegraph_file"`
CallGraphFile string `json:"callgraph_file"`
ThreadStats []ThreadInfo `json:"thread_stats"`
TopFuncs TopFuncsMap `json:"top_funcs"`
TotalSamples int64 `json:"total_samples"`
}
TracingData holds tracing analysis data.
func (*TracingData) Summary ¶
func (d *TracingData) Summary() map[string]interface{}
Summary returns a summary of the tracing analysis.
func (*TracingData) TopItems ¶
func (d *TracingData) TopItems() []TopItem
TopItems returns the top functions from tracing.
func (*TracingData) Type ¶
func (d *TracingData) Type() AnalysisDataType
Type returns the analysis data type.