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/'));
 }
示例#2
0
<?php

require_once __DIR__ . '/../HeydayXhprof.php';
if (HeydayXhprof::isAllowed(isset($_GET['url']) ? $_GET['url'] : $_SERVER['SCRIPT_FILENAME'])) {
    HeydayXhprof::start('Global');
}