diff --git a/src/Profilers/Tideways.php b/src/Profilers/Tideways.php index 33a4b9b..e8a7935 100644 --- a/src/Profilers/Tideways.php +++ b/src/Profilers/Tideways.php @@ -4,6 +4,11 @@ use Xhgui\Profiler\ProfilingFlags; +/** + * v4 (tideways) + * + * @see https://github.com/tideways/php-profiler-extension + */ class Tideways extends AbstractProfiler { /** diff --git a/src/Profilers/TidewaysXHProf.php b/src/Profilers/TidewaysXHProf.php new file mode 100644 index 0000000..3727653 --- /dev/null +++ b/src/Profilers/TidewaysXHProf.php @@ -0,0 +1,42 @@ +combineFlags($flags), $options); + } + + /** + * {@inheritdoc} + */ + public function disable() + { + return tideways_xhprof_disable(); + } + + /** + * {@inheritdoc} + */ + public function getProfileFlagMap() + { + return array( + ProfilingFlags::CPU => TIDEWAYS_XHPROF_FLAGS_CPU, + ProfilingFlags::MEMORY => TIDEWAYS_XHPROF_FLAGS_MEMORY, + ProfilingFlags::NO_BUILTINS => TIDEWAYS_XHPROF_FLAGS_NO_BUILTINS, + ProfilingFlags::NO_SPANS => 0, + ); + } +} diff --git a/tests/TidewaysXHProfTest.php b/tests/TidewaysXHProfTest.php new file mode 100644 index 0000000..0cb6ec1 --- /dev/null +++ b/tests/TidewaysXHProfTest.php @@ -0,0 +1,32 @@ +profiler = new TidewaysXHProf(); + } + + public function testDefaults() + { + $data = $this->runProfiler(); + $this->assertCount(3, $data); + } + + public function testNoFlags() + { + $flags = array( + ProfilingFlags::NO_BUILTINS, + ); + $data = $this->runProfiler($flags); + $this->assertCount(2, $data); + } +}