php查看代码执行时间工具类
来源:互联网 发布:程序员成长的烦恼 编辑:程序博客网 时间:2024/05/17 02:27
<?php
class RunTime //页面执行时间类
{
private $starttime; //页面开始执行时间
private $stoptime; //页面结束执行时间
private $spendtime; //页面执行花费时间
function getmicrotime() { //获取返回当前微秒数的浮点数
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function start() { //页面开始执行函数,返回开始页面执行的时间
$this->starttime = $this->getmicrotime();
}
function end() {//显示页面执行的时间
$this->stoptime = $this->getmicrotime();
$this->spendtime = $this->stoptime - $this->starttime;
//return round($this->spendtime,10);
}
function display() {
//$this->end();
echo "运行时间:" . round($this->spendtime, 10) . "秒";
}
}
//调用方法
$timer=new Runtime();
$timer->start();
for($i=0; $i<1000000; $i++) {
$b = 2;
}
$timer->end();
$timer->display();
class RunTime //页面执行时间类
{
private $starttime; //页面开始执行时间
private $stoptime; //页面结束执行时间
private $spendtime; //页面执行花费时间
function getmicrotime() { //获取返回当前微秒数的浮点数
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function start() { //页面开始执行函数,返回开始页面执行的时间
$this->starttime = $this->getmicrotime();
}
function end() {//显示页面执行的时间
$this->stoptime = $this->getmicrotime();
$this->spendtime = $this->stoptime - $this->starttime;
//return round($this->spendtime,10);
}
function display() {
//$this->end();
echo "运行时间:" . round($this->spendtime, 10) . "秒";
}
}
//调用方法
$timer=new Runtime();
$timer->start();
for($i=0; $i<1000000; $i++) {
$b = 2;
}
$timer->end();
$timer->display();
- php查看代码执行时间工具类
- php 查看代码执行时间
- 查看代码执行时间
- php测试代码执行时间的类
- php 计算代码执行时间
- php记录代码执行时间
- php计算代码执行时间
- php 计算代码执行时间
- PHP测试代码执行时间
- php 计算代码执行时间
- php记录代码执行时间
- php记录代码执行时间
- PHP记录代码执行时间
- PHP检测代码执行时间
- 统计PHP代码的执行时间
- PHP代码优化和查看 的工具
- php记录代码执行时间(实现代码)
- php 计算页面执行时间来优化代码
- 全面理解面向对象的 JavaScript
- asp.net webservice 保存状态
- 如何了解百度竞价调价技巧
- Centos IP、DNS设置
- 限定textarea只能输入200字符
- php查看代码执行时间工具类
- Listpicker with button in full mode in WP7
- lenovo Y450 --- Ubuntu 13.04 安装 博通无线网卡驱动(系统离线上不了网的情况)
- Linux上vi(vim)编辑器使用说明
- 8个笑话 8味人生
- Dividing title to chapters
- 使用CStdioFile读取/写入中文文本文件出错的问题
- HDU 1561 The more, The Better(树形DP)
- 如何清除SQL Server Management Studio的最近服务器列表