Skip to content

Instantly share code, notes, and snippets.

@shoman4eg
Created June 29, 2016 12:04
Show Gist options
  • Save shoman4eg/be959e097007c3790e0e09c3f05f5d2a to your computer and use it in GitHub Desktop.
Save shoman4eg/be959e097007c3790e0e09c3f05f5d2a to your computer and use it in GitHub Desktop.
<?php
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$GLOBALS["DB"]->ShowSqlStat = true;
$application = \Bitrix\Main\Application::getInstance();
$connection = $application->getConnection();
$connection->startTracker();
$sqlTracker = $connection->getTracker();
// Сюда вставить sql запрос.
var_dump($sqlTracker->getTime());
var_dump($sqlTracker->getCounter());
var_dump($sqlTracker->getQueries());
$GLOBALS["DB"]->ShowSqlStat = false;
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment