Skip to content

Commit

Permalink
Hot-fix: Fixed first iteration detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Knap committed Oct 3, 2016
1 parent 081bd52 commit 7562c94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Profiler/Adapter/TracyBarAdapter.php
Expand Up @@ -180,12 +180,13 @@ private function getMemoryChart()
);
}

$firstIteration = true;
$prevX = 0;
$prevY = $maxHeight;
$lines = "";
$points = "";
$this->profilerService->iterateMemoryTimeLine(function ($time, $height, $metaData) use ($colors, &$memoryChart, $maxWidth, $maxHeight, $margin, &$prevX, &$prevY, &$lines, &$points) {
if ($prevX == 0) {
$this->profilerService->iterateMemoryTimeLine(function ($time, $height, $metaData) use ($colors, &$memoryChart, $maxWidth, $maxHeight, $margin, &$firstIteration, &$prevX, &$prevY, &$lines, &$points) {
if ($firstIteration) {
/** @noinspection PhpInternalEntityUsedInspection */
$memoryChart .= sprintf(
"<text x='%d' y='%d' font-size='%d'>%d kB</text>",
Expand All @@ -194,6 +195,7 @@ private function getMemoryChart()
10,
floor($metaData[ProfilerService::META_MEMORY_PEAK] / 1024)
);
$firstIteration = false;
}
/** @noinspection PhpInternalEntityUsedInspection */
$thisX = floor(max(0, $time) / $metaData[ProfilerService::META_TIME_TOTAL] * $maxWidth);
Expand Down

0 comments on commit 7562c94

Please sign in to comment.