示例#1
0
<?php

/**
* A sample php file that uses the pinba php extension
*/
// start time measurement asap
$starttime = microtime(true);
include 'prtbfr.php';
include 'pinba.php';
include 'pinbafunctions.php';
// this is optional - if omitted time measurement will start when pinba.php file is included
pinba::init($starttime);
// do some stuff here ...
// measure some operation
$t = pinba_timer_start(array("group" => "mysql", "server" => "dbs2", "operation" => "select"));
$result = mysql_query("SELECT ...", $connection);
pinba_timer_stop($t);
// that's all folks!
示例#2
0
        self::write($bytes, $length);
    }
    private static function write($bytes, $length)
    {
        fwrite(self::$resource, $bytes, $length);
    }
    private static function stringField($field_id, $field_value)
    {
        self::writeInteger($field_id << 3 | 2);
        self::writeString($field_value);
    }
    private static function integerField($field_id, $field_value)
    {
        self::writeInteger($field_id << 3 | 0);
        self::writeInteger($field_value);
    }
    private static function floatField($field_id, $field_value)
    {
        self::writeInteger($field_id << 3 | 5);
        self::writeFloat($field_value);
    }
    public static function shutdownHandler()
    {
        if (self::$autoFlush) {
            self::flush();
        }
    }
}
// try to start time measurement as soon as we can
pinba::init();