当前位置: 首页>>代码示例>>PHP>>正文


PHP PHP_Timer::requestTime方法代码示例

本文整理汇总了PHP中PHP_Timer::requestTime方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_Timer::requestTime方法的具体用法?PHP PHP_Timer::requestTime怎么用?PHP PHP_Timer::requestTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHP_Timer的用法示例。


在下文中一共展示了PHP_Timer::requestTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: timeSinceStartOfRequest

                return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
            }
        }
        return $ms . ' ms';
    }
    /**
     * Formats the elapsed time since the start of the request as a string.
     *
     * @return string
     */
    public static function timeSinceStartOfRequest()
    {
        return self::secondsToTimeString(microtime(true) - self::$requestTime);
    }
    /**
     * Returns the resources (time, memory) of the request as a string.
     *
     * @return string
     */
    public static function resourceUsage()
    {
        return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(true) / 1048576);
    }
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} elseif (isset($_SERVER['REQUEST_TIME'])) {
    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
} else {
    PHP_Timer::$requestTime = microtime(true);
}
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:31,代码来源:Timer.php

示例2: timeSinceStartOfRequest

            if ($ms >= $value) {
                $time = floor($ms / $value * 100.0) / 100.0;
                return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
            }
        }
        return $ms . ' ms';
    }
    /**
     * Formats the elapsed time since the start of the request as a string.
     *
     * @return string
     */
    public static function timeSinceStartOfRequest()
    {
        return self::secondsToTimeString(microtime(TRUE) - self::$requestTime);
    }
    /**
     * Returns the resources (time, memory) of the request as a string.
     *
     * @return string
     */
    public static function resourceUsage()
    {
        return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(TRUE) / 1048576);
    }
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} else {
    PHP_Timer::$requestTime = microtime(TRUE);
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:31,代码来源:Timer.php

示例3: timeSinceStartOfRequest

        }
        return $buffer;
    }
    /**
     * Formats the elapsed time since the start of the request as a string.
     *
     * @return string
     */
    public static function timeSinceStartOfRequest()
    {
        return self::secondsToTimeString(time() - self::$requestTime);
    }
    /**
     * Returns the resources (time, memory) of the request as a string.
     *
     * @return string
     */
    public static function resourceUsage()
    {
        return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(TRUE) / 1048576);
    }
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
    PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} else {
    if (isset($_SERVER['REQUEST_TIME'])) {
        PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
    } else {
        PHP_Timer::$requestTime = time();
    }
}
开发者ID:nizarbey,项目名称:phpunit-all-in-one,代码行数:31,代码来源:Timer.php


注:本文中的PHP_Timer::requestTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。