Skip to content
Extraits de code Groupes Projets
Valider eb9e188f rédigé par Benaka Moorthi's avatar Benaka Moorthi
Parcourir les fichiers

Allow easy use of XHProf when running phpunit tests from the command line.

parent ed60fae0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -25,6 +25,32 @@ if (!defined('PIWIK_INCLUDE_SEARCH_PATH')) {
error_reporting(E_ALL | E_NOTICE);
@date_default_timezone_set('UTC');
$useXhprof = true;
if ($useXhprof) {
require_once PIWIK_INCLUDE_PATH . '/tests/lib/xhprof-0.9.2/xhprof_lib/utils/xhprof_runs.php';
if (!isset($profilerNamespace)) {
$firstLineOfGitHead = file(PIWIK_INCLUDE_PATH . '/.git/HEAD');
$firstLineOfGitHead = $firstLineOfGitHead[0];
$parts = explode("/", $firstLineOfGitHead);
$currentGitBranch = trim($parts[2]);
$profilerNamespace = "piwik.$currentGitBranch";
}
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(function () use($profilerNamespace) {
$xhprofData = xhprof_disable();
$xhprofRuns = new \XHProfRuns_Default();
$runId = $xhprofRuns->save_run($xhprofData, $profilerNamespace);
echo "\n\nPROFILER RUN URL: /tests/lib/xhprof-0.9.2/xhprof_html/?source=$profilerNamespace&run=$runId\n\n";
});
}
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter