Beispiel #1
0
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
 * Example for IOProfiler
 *
 * PHP version 5
 *
 * @category  Library
 * @package   IOProfiler
 * @author    Stéphane Lavergne <*****@*****.**>
 * @copyright 2010-2016 Stéphane Lavergne
 * @license   http://www.gnu.org/licenses/gpl-3.0.txt  GNU GPL version 3
 * @link      https://github.com/VPhantom/php-ioprofiler
 */
require_once 'IOProfiler.php';
IOProfiler::enable();
$profile = new IOProfiler();
// Timer starts
usleep(500000);
// 0.500 sec
$start = IOProfiler::now();
usleep(750000);
// 0.750 sec
$profile->log('test', '123456789', $start);
$start = IOProfiler::now();
usleep(200000);
// 0.200 sec
$profile->log('test', '123456789', $start);
$start = IOProfiler::now();
usleep(125000);
// 0.125 sec
$profile->log('test', 'different', $start);
Beispiel #2
0
 /**
  * Disable profiling
  *
  * (Default.)  Sets an internal flag telling IOProfiler to return
  * immediately without performing any actions for all methods except
  * instance construction.
  *
  * This implementation makes it possible to enable and disable profiling
  * several times throughout the life of a program and still count time from
  * the moment of construction.
  *
  * @return null
  */
 public static function disable()
 {
     self::$_enabled = false;
 }