public function testExclusions()
 {
     $exclusions = array('hello');
     HeydayXhprof::setExclusions($exclusions);
     $this->assertEquals($exclusions, HeydayXhprof::getExclusions());
     $exclusions = array('hello', 'something');
     HeydayXhprof::addExclusion('something');
     $this->assertEquals($exclusions, HeydayXhprof::getExclusions());
     $exclusions = array('hello', 'something', 'bob');
     $newExclusions = array('bob');
     HeydayXhprof::addExclusions($newExclusions);
     $this->assertEquals($exclusions, HeydayXhprof::getExclusions());
     $this->assertTrue(HeydayXhprof::isExcluded('bob'));
     $this->assertTrue(HeydayXhprof::isExcluded('hello'));
     $this->assertTrue(HeydayXhprof::isExcluded('Hello'));
     $this->assertFalse(HeydayXhprof::isExcluded('barbie'));
     HeydayXhprof::setProbability(1);
     $this->assertTrue(HeydayXhprof::isAllowed('barbie'));
     $this->assertFalse(HeydayXhprof::isAllowed('/bob/'));
 }
Exemplo n.º 2
0
<?php

require_once __DIR__ . '/../HeydayXhprof.php';
if (HeydayXhprof::isAllowed(isset($_GET['url']) ? $_GET['url'] : $_SERVER['SCRIPT_FILENAME'])) {
    HeydayXhprof::start('Global');
}
Exemplo n.º 3
0
 /**
  * Set the app name for profile saving and run saving.
  *
  * @param string $app_name App name to set
  *
  * @return null
  */
 public static function setAppName($app_name)
 {
     self::$app_name = urlencode($app_name);
 }