Exemplo n.º 1
0
    protected function configure()
    {
        parent::configure();
        $this->setName('db:variables')->setDescription('Shows important variables or custom selected');
        $help = <<<HELP
This command is useful to print all important variables about the current database.
HELP;
        $this->setHelp($help);
    }
Exemplo n.º 2
0
 /**
  * @param array $outputVars
  * @param bool  $hasDescription
  *
  * @return array
  */
 protected function generateRows(array $outputVars, $hasDescription)
 {
     $rows = parent::generateRows($outputVars, $hasDescription);
     if (false === $hasDescription) {
         return $rows;
     }
     if (isset($this->_allVariables['Handler_read_rnd_next'])) {
         $tableScanRate = ($this->_allVariables['Handler_read_rnd_next'] + $this->_allVariables['Handler_read_rnd']) / ($this->_allVariables['Handler_read_rnd_next'] + $this->_allVariables['Handler_read_rnd'] + $this->_allVariables['Handler_read_first'] + $this->_allVariables['Handler_read_next'] + $this->_allVariables['Handler_read_key'] + $this->_allVariables['Handler_read_prev']);
         $rows[] = array('Full table scans', sprintf('%.2f', $tableScanRate * 100) . '%', $this->formatDesc('HINT: "Handler_read_rnd_next" is reset to zero when reached the value of 2^32 (4G).'));
     }
     if (isset($this->_allVariables['Innodb_buffer_pool_read_requests'])) {
         $bufferHitRate = $this->_allVariables['Innodb_buffer_pool_read_requests'] / ($this->_allVariables['Innodb_buffer_pool_read_requests'] + $this->_allVariables['Innodb_buffer_pool_reads']);
         $rows[] = array('InnoDB Buffer Pool hit', sprintf('%.2f', $bufferHitRate * 100) . '%', $this->formatDesc('An InnoDB Buffer Pool hit ratio below 99.9% is a weak indicator that
             your InnoDB Buffer Pool could be increased.'));
     }
     return $rows;
 }