public function replaceProfiler()
    {
        /** @var Magento_Db_Adapter_Pdo_Mysql $connection */
        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        $currentProfile = $connection->getProfiler();

        if ($currentProfile) {
            // Copy queries
            $this->_queryProfiles = $currentProfile->_queryProfiles;
        }

        $this->setEnabled($currentProfile->getEnabled());
        $connection->setProfiler($this);
    }