performance

package
v0.0.0-...-0b65b40 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStats

type MemoryStats struct {
	Alloc       uint64    `json:"alloc"`
	TotalAlloc  uint64    `json:"total_alloc"`
	Sys         uint64    `json:"sys"`
	Mallocs     uint64    `json:"mallocs"`
	Frees       uint64    `json:"frees"`
	LiveObjects uint64    `json:"live_objects"`
	PauseNs     []uint64  `json:"pause_ns"`
	NumGC       uint32    `json:"num_gc"`
	Timestamp   time.Time `json:"timestamp"`
}

MemoryStats holds memory usage statistics

type PerformanceMetrics

type PerformanceMetrics struct {
	EmbeddingLoadTime    time.Duration `json:"embedding_load_time"`
	SchemaLoadTime       time.Duration `json:"schema_load_time"`
	LLMResponseTime      time.Duration `json:"llm_response_time"`
	SemanticSearchTime   time.Duration `json:"semantic_search_time"`
	FileGenerationTime   time.Duration `json:"file_generation_time"`
	MCPStartupTime       time.Duration `json:"mcp_startup_time"`
	ChatSessionStartTime time.Duration `json:"chat_session_start_time"`
}

PerformanceMetrics tracks various performance metrics

type Profiler

type Profiler struct {
	// contains filtered or unexported fields
}

Profiler provides performance monitoring capabilities

func NewProfiler

func NewProfiler(logger logger.Logger) *Profiler

NewProfiler creates a new performance profiler

func (*Profiler) ForceGC

func (p *Profiler) ForceGC(ctx context.Context) MemoryStats

ForceGC triggers garbage collection and measures the impact

func (*Profiler) GeneratePerformanceReport

func (p *Profiler) GeneratePerformanceReport() map[string]interface{}

GeneratePerformanceReport creates a comprehensive performance report

func (*Profiler) GetMemoryStats

func (p *Profiler) GetMemoryStats() []MemoryStats

GetMemoryStats returns current memory statistics

func (*Profiler) GetPerformanceMetrics

func (p *Profiler) GetPerformanceMetrics() PerformanceMetrics

GetPerformanceMetrics returns current performance metrics

func (*Profiler) MemoryUsageMB

func (p *Profiler) MemoryUsageMB() float64

MemoryUsageMB returns current memory usage in megabytes

func (*Profiler) RecordMemoryUsage

func (p *Profiler) RecordMemoryUsage(ctx context.Context) MemoryStats

RecordMemoryUsage captures current memory statistics

func (*Profiler) StartMemoryMonitoring

func (p *Profiler) StartMemoryMonitoring(ctx context.Context, interval time.Duration)

StartMemoryMonitoring begins periodic memory monitoring

func (*Profiler) TimeOperation

func (p *Profiler) TimeOperation(ctx context.Context, operationType string, operation func() error) error

TimeOperation measures the duration of an operation

Jump to

Keyboard shortcuts

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