Skip to content

Commit

Permalink
bench: Empty index.php web requests overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM committed Jan 5, 2024
1 parent 8bf515e commit b71c98e
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/Benchmarks/Integrations/EmptyFileBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace Benchmarks\Integrations;

use DDTrace\Tests\Common\WebFrameworkTestCase;
use DDTrace\Tests\Frameworks\Util\Request\GetSpec;

class EmptyFileBench extends WebFrameworkTestCase
{
/**
* @BeforeMethods("disabledTracing")
* @AfterMethods("afterMethod")
* @Revs(10)
* @Iterations(10)
* @OutputTimeUnit("microseconds")
* @RetryThreshold(10.0)
*/
public function benchEmptyFileBaseline()
{
$this->call(GetSpec::create(
'A web request to a framework not using auto loaders',
'/'
));
}

/**
* @BeforeMethods("enableTracing")
* @AfterMethods("afterMethod")
* @Revs(10)
* @Iterations(10)
* @OutputTimeUnit("microseconds")
* @RetryThreshold(10.0)
*/
public function benchEmptyFileOverhead()
{
$this->call(GetSpec::create(
'A web request to a framework not using auto loaders',
'/'
));
}

public static function getAppIndexScript()
{
return __DIR__ . '/../../Frameworks/Custom/Version_Not_Autoloaded/index.php';
}

public function disabledTracing()
{
$this->setUpWebServer([
'DD_TRACE_ENABLED' => 0,
]);
}

public function afterMethod()
{
$this->TearDownAfterClass();
}

public function enableTracing()
{
$this->setUpWebServer([
'DD_TRACE_ENABLED' => 1,
]);
}
}

0 comments on commit b71c98e

Please sign in to comment.