Measure resource drift from a baseline and label the deviation level.

resource drift Resource drift tracks how far current usage has moved from a known baseline value.

Resource Drift Report

current
resource_drift.php
Replay: real traced execution (multi-file project)
<?php
$current = 112;
$baseline = 100;
$drift = $current - $baseline;
$driftStatus = "normal";

if ($drift >= 25) {
    $driftStatus = "high";
} elseif ($drift >= 10) {
    $driftStatus = "elevated";
}

echo "current=" . $current . " drift=" . $drift . " status=" . $driftStatus . "\n";
<?php
$current = 103;
$baseline = 100;
$drift = $current - $baseline;
$driftStatus = "normal";

if ($drift >= 25) {
    $driftStatus = "high";
} elseif ($drift >= 10) {
    $driftStatus = "elevated";
}

echo "current=" . $current . " drift=" . $drift . " status=" . $driftStatus . "\n";
<?php
$current = 130;
$baseline = 100;
$drift = $current - $baseline;
$driftStatus = "normal";

if ($drift >= 25) {
    $driftStatus = "high";
} elseif ($drift >= 10) {
    $driftStatus = "elevated";
}

echo "current=" . $current . " drift=" . $drift . " status=" . $driftStatus . "\n";
  1. $current ← 112, $baseline ← 100, $drift ← 12, $driftStatus ← normal

    1<?php2$current→ 112 = 112; //@current=103, 1303$baseline→ 100 = 100;4$drift→ 12 = $current112 - $baseline100;5$driftStatus→ normal = "normal";67if ($drift >= 25) {8    $driftStatus = "high";9} elseif ($drift >= 10) {10    $driftStatus→ elevated = "elevated";11}1213echo "current=" . $current112 . " drift=" . $drift12 . " status=" . $driftStatuselevated . "\n";
    outputcurrent=112 drift=12 status=elevated
  1. $current ← 103, $baseline ← 100, $drift ← 3, $driftStatus ← normal

    1<?php2$current→ 103 = 103;3$baseline→ 100 = 100;4$drift→ 3 = $current103 - $baseline100;5$driftStatus→ normal = "normal";67if ($drift >= 25) {8    $driftStatus = "high";9} elseif ($drift >= 10) {10    $driftStatus = "elevated";11}1213echo "current=" . $current103 . " drift=" . $drift3 . " status=" . $driftStatusnormal . "\n";
    outputcurrent=103 drift=3 status=normal
  1. $current ← 130, $baseline ← 100, $drift ← 30, $driftStatus ← normal

    1<?php2$current→ 130 = 130;3$baseline→ 100 = 100;4$drift→ 30 = $current130 - $baseline100;5$driftStatus→ normal = "normal";
  2. $driftStatus ← high

    7if ($drift30 >= 25) {8    $driftStatus→ high = "high";9} elseif ($drift >= 10) {
  3. echo "current=" . $current . " drift=" . $drift . " status=" . $driftS…

    13echo "current=" . $current130 . " drift=" . $drift30 . " status=" . $driftStatushigh . "\n";
    outputcurrent=130 drift=30 status=high