PerformanceTool

Profiler

CPU- und Memory-Profiling mit Flame Graphs, Allocation Tracking und Performance-Analyse.

Features

CPU Profiling

Hotspots identifizieren

Memory

Allocation Tracking

Flame Graphs

Visuelle Analyse

Timing

Funktions-Zeitmessung

Live

Real-time Monitoring

Reports

HTML/JSON Export

CPU Profiling

# CPU-Profiling starten
velin profile cpu --duration 30s --output cpu.prof

# Mit Flame Graph
velin profile cpu --flame-graph --output flame.svg

# Bestimmte Funktion profilen
velin profile cpu --filter "processOrder"

Memory Profiling

# Memory-Snapshot
velin profile memory --snapshot

# Allocation Tracking
velin profile memory --allocations --duration 60s

# Memory Leaks finden
velin profile memory --leak-detection

Programmatisches Profiling

use profiler

fn processLargeDataset(data: List<Record>) {
    // Profiling-Block
    profiler.start("data_processing");
    
    for record in data {
        process(record);
    }
    
    let stats = profiler.stop("data_processing");
    log.info("Dauer: " + stats.duration + "ms");
    log.info("Memory: " + stats.memoryUsed + "MB");
}

// Decorator für automatisches Profiling
@Profile
fn heavyComputation() {
    // Wird automatisch gemessen
}

Report generieren

# HTML Report
velin profile report --input cpu.prof --format html --output report.html

# JSON für CI/CD
velin profile report --input cpu.prof --format json

# Vergleich zweier Profile
velin profile diff --before v1.prof --after v2.prof