code: public function setSqlProfilerStatus($isEnabled)
      {
          $filePath = $this->getLocalXmlFilePath();
          $xml = $this->loadXmlFile($filePath);
          if ($xml === false) {
              throw new Exception("Unable to parse local.xml configuration file: {$filePath}");
          }
  
          /** @var SimpleXMLElement $connectionNode */
          $connectionNode = $xml->global->resources->default_setup->connection;
          if ($isEnabled) {
              /** @noinspection PhpUndefinedFieldInspection */
              $connectionNode->profiler = '1';
          } else {
              unset($connectionNode->profiler);
          }
  
          if ($this->saveXml($xml, $filePath) === false) {
              throw new Exception("Unable to save {$filePath}: check if web server user has write permission");
          }
      }
docs: Changes status for SQL profiler
  
  @param bool $isEnabled
  @throws Exception