Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Util_Bench
  • Util_ErrorHandler
  • Util_Pagination
  • Util_String
  • Util_Token
  • Util_UserAgent

Exceptions

  • Util_ExceptionHandler
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Pry Framework
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file LICENSE.txt.
 10:  * 
 11:  * @version $Revision: 276 $
 12:  */
 13: 
 14: /**
 15:  * Classe bench. Mesure de performance de script php avec possibilité d'ajout de flag intermédiaire.
 16:  * 
 17:  * @category Pry
 18:  * @package Util
 19:  * @version 1.0.3
 20:  * @author Olivier ROGER <oroger.fr>
 21:  * 
 22:  */
 23: class Util_Bench // Amel bench ? ==>[]
 24: {
 25: 
 26:     /**
 27:      * Temps de début.<br />Valeur par défaut : 0
 28:      * @var int
 29:      * @access private
 30:      */
 31:     private $start;
 32: 
 33:     /**
 34:      * Tableau de résultat.
 35:      * @var array
 36:      * @access public
 37:      */
 38:     private $resultat;
 39: 
 40:     /**
 41:      * Constructeur.
 42:      * Initialisation des valeurs
 43:      *
 44:      */
 45:     public function __construct()
 46:     {
 47:         $this->start = 0;
 48:         $this->resultat = array();
 49:     }
 50: 
 51:     /**
 52:      * Départ.
 53:      * Lance le début du calcul de temps
 54:      *
 55:      */
 56:     public function start()
 57:     {
 58:         $this->start = $this->get_micro();
 59:     }
 60: 
 61:     /**
 62:      * Prend un temps intermédiaire.
 63:      *
 64:      * @param $nom Nom du temps intermédiaire
 65:      */
 66:     public function add_flag($nom)
 67:     {
 68:         $top = $this->get_micro() - $this->start;
 69:         $this->resultat[$nom] = $top;
 70:     }
 71: 
 72:     /**
 73:      * Arrete le calcul.
 74:      *
 75:      */
 76:     public function stop()
 77:     {
 78:         $end = $this->get_micro() - $this->start;
 79:         $this->resultat['total'] = $end;
 80:     }
 81: 
 82:     /**
 83:      * Donne les tableau de résultat.
 84:      *
 85:      * @return Tableau de résultats.
 86:      */
 87:     public function result()
 88:     {
 89:         return $this->resultat;
 90:     }
 91: 
 92:     /**
 93:      * Donne les miliseconde
 94:      * @access private
 95:      * @return Float temps en milisecondes
 96:      */
 97:     private function get_micro()
 98:     {
 99:         $temps = microtime();
100:         $temps = explode(' ', $temps);
101:         $temps = $temps[1] + $temps[0];
102:         return (float) $temps;
103:     }
104: 
105: }
106: 
107: ?>
Pry Framework API documentation generated by ApiGen 2.6.1