Skip to main content
Monitor system resources during test execution including CPU usage, memory consumption, network traffic, and process-level diagnostics for performance optimization and troubleshooting.

Performance Overview

Real-time system metrics during test execution:
System Performance (Test Duration: 45s):
┌────────────────────────────────────────────────────┐
│ CPU Usage:                                         │
│ Average: 42%  Peak: 78%  Current: 35%              │
│ ████████████████████░░░░░░░░░░░░░░░ 42%           │
│                                                    │
│ Memory Usage:                                      │
│ Used: 2.4 GB / 8 GB (30%)                          │
│ ██████████████░░░░░░░░░░░░░░░░░░░░░ 30%           │
│                                                    │
│ Network Traffic:                                   │
│ Downloaded: 451 KB  Uploaded: 12 KB                │
│ Bandwidth: ▂▃▅▇▅▃▂▁▂▃▅▇▅▃▂                         │
│                                                    │
│ Disk I/O:                                          │
│ Read: 12 MB  Write: 3.4 MB                         │
│ ▂▁▂▃▂▁▂▁▁▂▃▅▃▂▁▂                                   │
└────────────────────────────────────────────────────┘

CPU Usage Timeline

Track CPU utilization over test duration:
CPU Usage (0s → 45s):
┌────────────────────────────────────────────────────┐
│ 100%│                                              │
│  90%│                                              │
│  80%│        ██                                    │
│  70%│       ████                                   │
│  60%│      ██████                                  │
│  50%│     ████████                                 │
│  40%│   ████████████  ████                         │
│  30%│  ██████████████████████                      │
│  20%│ ████████████████████████████                 │
│  10%│██████████████████████████████████           │
│   0%└──────┬──────┬──────┬──────┬──────┬──────    │
│          0s     10s    20s    30s    40s           │
│                                                    │
│ Key Events:                                        │
│ [0:08] CPU spike: Page load (78%)                  │
│ [0:15] CPU spike: API processing (65%)             │
│ [0:25] CPU spike: Dashboard render (72%)           │
│                                                    │
│ Statistics:                                        │
│ Average: 42%                                       │
│ Peak: 78% at 0:08                                  │
│ Lowest: 12% at 0:35                                │
│ Std Dev: 18.5%                                     │
└────────────────────────────────────────────────────┘

Memory Usage

Monitor RAM consumption:
Memory Usage (0s → 45s):
┌────────────────────────────────────────────────────┐
│ 8 GB│                                              │
│ 7 GB│                                              │
│ 6 GB│                                              │
│ 5 GB│                                              │
│ 4 GB│                                              │
│ 3 GB│                            ████████████████  │
│ 2 GB│              ██████████████████████████████  │
│ 1 GB│    ██████████████████████████████████████    │
│ 0 GB└──────┬──────┬──────┬──────┬──────┬──────    │
│          0s     10s    20s    30s    40s           │
│                                                    │
│ Memory Breakdown:                                  │
│ Browser Process:     1.8 GB (75%)                  │
│ Renderer Process:    456 MB (19%)                  │
│ GPU Process:         89 MB (4%)                    │
│ TestDriver:          45 MB (2%)                    │
│                                                    │
│ Heap Statistics:                                   │
│ Total Heap Size:     234 MB                        │
│ Used Heap:           187 MB (80%)                  │
│ Heap Limit:          2048 MB                       │
│                                                    │
│ Warnings:                                          │
│ ⚠️ Memory increased 800MB during test              │
│ ⚠️ Possible memory leak detected                   │
└────────────────────────────────────────────────────┘
Sustained memory growth may indicate memory leaks in the application. Check for unreleased event listeners or DOM references.

Process-Level Metrics

Detailed breakdown by process:
Chrome Browser Process:
┌────────────────────────────────────────────────┐
│ PID: 12345                                     │
│ CPU: 25%  (Average: 22%, Peak: 45%)            │
│ Memory: 1.8 GB                                 │
│ Threads: 24                                    │
│                                                │
│ Resource Usage:                                │
│ CPU Time: 12.3s                                │
│ Handles: 2,456                                 │
│ GDI Objects: 234                               │
│                                                │
│ Network:                                       │
│ Connections: 8 active                          │
│ Downloaded: 451 KB                             │
│ Uploaded: 12 KB                                │
└────────────────────────────────────────────────┘

Network Bandwidth

Track network throughput:
Network Bandwidth (0s → 45s):
┌────────────────────────────────────────────────────┐
│ Download Speed:                                    │
│ 50 KB/s│        ▇▇                                 │
│ 40 KB/s│       ███▇                                │
│ 30 KB/s│      ██████                               │
│ 20 KB/s│     ████████▇                             │
│ 10 KB/s│   ██████████████                          │
│   0    └──────┬──────┬──────┬──────┬──────         │
│             0s     10s    20s    30s    40s        │
│                                                    │
│ Upload Speed:                                      │
│  5 KB/s│  ▇                                        │
│  4 KB/s│  █▇                                       │
│  3 KB/s│  ██▇                                      │
│  2 KB/s│  ████▇                                    │
│  1 KB/s│▇▇█████▇                                   │
│   0    └──────┬──────┬──────┬──────┬──────         │
│             0s     10s    20s    30s    40s        │
│                                                    │
│ Total Traffic:                                     │
│ Downloaded: 451.6 KB                               │
│ Uploaded: 12.3 KB                                  │
│ Ratio: 37:1                                        │
└────────────────────────────────────────────────────┘

Disk I/O

Monitor disk read/write activity:
Disk I/O Operations:
┌────────────────────────────────────────────────────┐
│ Read Operations:                                   │
│ Total: 12.4 MB                                     │
│ Files Read: 234                                    │
│ Average Speed: 45 MB/s                             │
│                                                    │
│ Top Read Operations:                               │
│ app.js              234 KB                         │
│ vendor.bundle.js    1.2 MB                         │
│ images/hero.jpg     456 KB                         │
│ styles.css          89 KB                          │
│                                                    │
│ Write Operations:                                  │
│ Total: 3.4 MB                                      │
│ Files Written: 12                                  │
│ Average Speed: 67 MB/s                             │
│                                                    │
│ Top Write Operations:                              │
│ dashcam-replay.webm     2.1 MB                     │
│ screenshots/*.png       892 KB                     │
│ cache/*.json           234 KB                      │
│ test-log.txt           89 KB                       │
└────────────────────────────────────────────────────┘

Performance Bottlenecks

Identify performance issues:

High CPU Usage

❌ CPU spike detected

Time: 0:08
Peak: 78% CPU
Duration: 2.3s

Cause:
Heavy JavaScript execution
during page load

Recommendation:
Consider code splitting
or lazy loading

Memory Growth

⚠️ Memory leak suspected

Start: 1.2 GB
End: 2.0 GB
Growth: +800 MB

Potential Causes:
- Unreleased listeners
- Cached DOM nodes
- Global variables

Action: Profile memory

Slow Network

⚠️ Slow API response

Endpoint: /api/dashboard
Time: 445ms
Expected: <200ms

Impact:
Dashboard load delayed

Recommendation:
Add caching or optimize
database queries

Disk Bottleneck

ℹ️ High disk I/O

Operation: Write
File: dashcam-replay.webm
Size: 2.1 MB
Time: 1.2s

Impact: Minimal
Expected for recording

Frame Rate (FPS)

Monitor rendering performance:
Frame Rate (60 FPS target):
┌────────────────────────────────────────────────────┐
│  60 │███████████████████████████████░░████████████  │
│  55 │                            ████              │
│  50 │                                              │
│  45 │                                              │
│  40 │                                              │
│  35 │                                              │
│  30 │                                              │
│     └──────┬──────┬──────┬──────┬──────┬──────    │
│          0s     10s    20s    30s    40s           │
│                                                    │
│ Statistics:                                        │
│ Average FPS: 58.4                                  │
│ Minimum FPS: 52 at 0:25                            │
│ Dropped Frames: 34 (2.5%)                          │
│                                                    │
│ Frame Drops:                                       │
│ [0:25] 8 frames dropped (Dashboard render)         │
│ Impact: Minor jank noticed                         │
└────────────────────────────────────────────────────┘
Frame rates below 30 FPS may cause visible jank. Target 60 FPS for smooth animations and interactions.

Resource Warnings

Performance alerts and recommendations:
Performance Warnings:
┌────────────────────────────────────────────────────┐
│ ⚠️ High CPU Usage (0:08)                           │
│    Peak: 78% for 2.3 seconds                       │
│    Cause: Heavy JavaScript execution               │
│    Recommendation: Profile and optimize code       │
│                                                    │
│ ⚠️ Memory Increase (0:00 → 0:45)                   │
│    Growth: +800 MB during test                     │
│    Potential leak: Check event listeners           │
│    Action: Run heap snapshot comparison            │
│                                                    │
│ ⚠️ Slow Network Request (0:21)                     │
│    Endpoint: /api/dashboard/data                   │
│    Time: 445ms (target: <200ms)                    │
│    Recommendation: Add caching or optimize query   │
│                                                    │
│ ℹ️ Frame Drops (0:25)                              │
│    Count: 8 frames                                 │
│    Context: Dashboard render                       │
│    Impact: Minor visual jank                       │
│    Recommendation: Optimize render logic           │
└────────────────────────────────────────────────────┘

Performance Comparison

Compare across test runs:
Performance Comparison (Last 5 runs):
┌────────────────────────────────────────────────────┐
│ Metric          Run 1   Run 2   Run 3   Run 4  Now │
├────────────────────────────────────────────────────┤
│ Avg CPU         38%     42%     35%     40%    42% │
│ Peak CPU        72%     78%     65%     70%    78% │
│ Memory End      1.9GB   2.0GB   1.7GB   1.8GB  2.0GB│
│ Network DL      445KB   451KB   423KB   438KB  451KB│
│ Test Duration   42s     45s     39s     43s    45s │
│ FPS Average     59      58      60      59     58  │
│                                                    │
│ Trends:                                            │
│ 📈 CPU usage increasing (↑4% vs avg)              │
│ 📈 Memory usage increasing (↑100MB vs avg)        │
│ → Network stable                                   │
│ → Performance stable overall                       │
└────────────────────────────────────────────────────┘

Export Performance Data

Download metrics for analysis:
{
  "testId": "test-123",
  "duration": 45000,
  "performance": {
    "cpu": {
      "average": 42,
      "peak": 78,
      "timeline": [
        { "time": 0, "usage": 15 },
        { "time": 1000, "usage": 35 },
        { "time": 8000, "usage": 78 }
      ]
    },
    "memory": {
      "start": 1200,
      "end": 2000,
      "peak": 2100,
      "growth": 800,
      "timeline": [
        { "time": 0, "mb": 1200 },
        { "time": 10000, "mb": 1600 },
        { "time": 45000, "mb": 2000 }
      ]
    },
    "network": {
      "downloaded": 451600,
      "uploaded": 12300,
      "requests": 9
    }
  }
}

Performance Profiling Integration

Connect with browser DevTools:
import { test } from 'vitest';
import { chrome } from 'testdriverai/presets';

test('profile performance', async (context) => {
  const { testdriver, page } = await chrome(context, {
    url: 'https://example.com'
  });

  // Start performance profiling
  await page.evaluate(() => {
    performance.mark('test-start');
  });

  await testdriver.find('dashboard link').click();
  
  // End profiling
  await page.evaluate(() => {
    performance.mark('test-end');
    performance.measure('test', 'test-start', 'test-end');
  });

  // Performance metrics automatically captured in dashcam
});
Replay Shows:
Performance Marks:
[0:00] 🏁 test-start
[0:15] 🏁 test-end
Duration: 15.234s

User Timing:
Measure: test (15.234s)

System Resource Alerts

Configure thresholds:
Alert Configuration:
┌────────────────────────────────────────────────────┐
│ CPU Threshold:                                     │
│ ⚠️ Warning at 70%                                  │
│ ❌ Critical at 90%                                 │
│                                                    │
│ Memory Threshold:                                  │
│ ⚠️ Warning at 80% (6.4 GB / 8 GB)                  │
│ ❌ Critical at 95% (7.6 GB / 8 GB)                 │
│                                                    │
│ Network Latency:                                   │
│ ⚠️ Warning at 500ms                                │
│ ❌ Critical at 1000ms                              │
│                                                    │
│ Frame Rate:                                        │
│ ⚠️ Warning at <45 FPS                              │
│ ❌ Critical at <30 FPS                             │
└────────────────────────────────────────────────────┘

Learn More