 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Init(logger *slog.Logger, enabled bool)
- func InitFromEnv(logger *slog.Logger)
- func IsProfilingEnabled() bool
- func Start(ctx context.Context, operation string) func(int, int64) *Profile
- type Profile
- type Profiler
- func (p *Profiler) ProfileFunc(ctx context.Context, operation string, fn func() error) (*Profile, error)
- func (p *Profiler) ProfileFuncWithMetrics(ctx context.Context, operation string, fn func() (int, int64, error)) (*Profile, error)
- func (p *Profiler) Start(ctx context.Context, operation string) func(lines int, bytes int64) *Profile
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFromEnv ¶
InitFromEnv initializes the global profiler using environment variables
func IsProfilingEnabled ¶
func IsProfilingEnabled() bool
IsProfilingEnabled checks if profiling is enabled via environment variables
Types ¶
type Profile ¶
type Profile struct {
	Operation    string        `json:"operation"`
	Duration     time.Duration `json:"duration_ns"`
	MemoryBefore uint64        `json:"memory_before_bytes"`
	MemoryAfter  uint64        `json:"memory_after_bytes"`
	MemoryDelta  int64         `json:"memory_delta_bytes"`
	LinesCount   int           `json:"lines_count,omitempty"`
	BytesCount   int64         `json:"bytes_count,omitempty"`
	Timestamp    time.Time     `json:"timestamp"`
}
    Profile represents performance metrics for an operation
func ProfileFunc ¶
ProfileFunc profiles a function using the global profiler
type Profiler ¶
type Profiler struct {
	// contains filtered or unexported fields
}
    Profiler provides minimal performance profiling capabilities
func (*Profiler) ProfileFunc ¶
func (p *Profiler) ProfileFunc(ctx context.Context, operation string, fn func() error) (*Profile, error)
ProfileFunc profiles a function execution
 Click to show internal directories. 
   Click to hide internal directories.