Documentation

Level 0: Monitoring

Level 0 provides lightweight performance monitoring without applying optimizations.

Overview

AspectValue
Overhead~10μs per call
Memory~1MB
PurposeBaseline metrics, profiling

What Gets Collected

Timing Metrics

  • Function execution time
  • Call frequency
  • Time distribution (min, max, mean, percentiles)

Resource Metrics

  • Memory allocation
  • CPU utilization
  • Thread activity

Enabling Level 0

Via Decorator

import epochly
@epochly.optimize(level=0)
def monitored_function(data):
return process(data)

Via Environment

export EPOCHLY_LEVEL=0

Accessing Metrics

import epochly
@epochly.optimize(level=0)
def my_function(data):
return [x ** 2 for x in data]
# Call function multiple times
for _ in range(100):
my_function(range(1000))
# Get metrics
metrics = epochly.get_metrics()
print(f"Total calls: {metrics.get('total_calls')}")
print(f"Mean time: {metrics.get('mean_time_ms')} ms")

Use Cases

  1. Baseline Measurement: Establish baseline before optimization
  2. Hot Path Detection: Identify which functions benefit from optimization
  3. Production Monitoring: Monitor performance without optimization