Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Stop passing on call data in measurements.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 30, 2015
1 parent 22a7217 commit 7979cb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/main/Tideways/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,10 @@ public static function start($apiKey = null, $sampleRate = null)
}

tideways_enable(
TIDEWAYS_FLAGS_NO_USERLAND | TIDEWAYS_FLAGS_NO_BUILTINS,
TIDEWAYS_FLAGS_NO_COMPILE | TIDEWAYS_FLAGS_NO_USERLAND | TIDEWAYS_FLAGS_NO_BUILTINS,
array('tranasction_function' => self::$defaultOptions['transaction_function'])
);

self::$sampling = true;
}

Expand Down Expand Up @@ -562,14 +563,7 @@ public static function stop()
if (!$sampling && $data) {
self::storeProfile(self::$operationName, $data, self::$customTimers);
} else {
$callData = $sampling ? $data : array();

self::storeMeasurement(
self::$operationName,
$duration,
$callData,
(self::$error !== false)
);
self::storeMeasurement(self::$operationName, $duration, (self::$error !== false));
}
}

Expand Down Expand Up @@ -621,14 +615,13 @@ private static function storeProfile($operationName, $data, $customTimers)
));
}

private static function storeMeasurement($operationName, $duration, array $callData, $isError)
private static function storeMeasurement($operationName, $duration, $isError)
{
self::$backend->storeMeasurement(array(
"op" => $operationName,
"wt" => $duration,
"mem" => round(memory_get_peak_usage() / 1024),
"apiKey" => self::$apiKey,
"c" => $callData,
"err" => $isError,
));
}
Expand Down
8 changes: 8 additions & 0 deletions tests/Tideways/ProfilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

class ProfilerTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (function_exists('tideways_prepend_overwritten') && tideways_prepend_overwritten()) {
$this->markTestSkipped('Cannot run tests when tideways is installed and loaded globally. Run with -dtideways.auto_prepend_library=0');
}
}

public function testStartStopProfile()
{
$alwaysSample = 100;
Expand Down Expand Up @@ -106,6 +113,7 @@ private function createBackend()
public function testDetectFramework()
{
\Tideways\Profiler::detectFramework(\Tideways\Profiler::FRAMEWORK_SYMFONY2_FRAMEWORK);
\Tideways\Profiler::start('foo');

$reflection = new \ReflectionClass('Tideways\Profiler');
$property = $reflection->getProperty('defaultOptions');
Expand Down

0 comments on commit 7979cb0

Please sign in to comment.