定制 speedy/timer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

speedy/timer

最新稳定版本:v1.0.3

Composer 安装命令:

composer require speedy/timer

包简介

A simple timer for measuring the speed of a script.

README 文档

README

Build Status

Speedy Timer

Speedy Timer is a package component for script runtime measurement that may be used for debugging applications within system development.

Requirements

  • >= php 7.1

Installation

$ composer require speedy/timer

Usage

Basic usage for activating the measurement of the runtime script:

require_once __DIR__ . '/vendor/autoload.php';

use Speedy\Timer\Timer;

$timer = new Timer();
$timer->start();
// some code
$item = $timer->stop();

var_dump($item->getTime()); // show run-time in milliseconds
var_dump($item->getTime(true)); // show run-time in microseconds

You can use shortcut to create the Timer class instance:

require_once __DIR__ . '/vendor/autoload.php';

$timer = timer()->start();
//some code
$item = $timer->stop();

var_dump($item->getTime());

To track the duration of different parts of the script it is possible to name each item in the following way:

require_once __DIR__ . '/vendor/autoload.php';

$timer = timer()->start('test1');
//some code
$timer = timer()->start('test2');
//some code
$item = $timer->stop('test1);
var_dump($item->getTime());
//some code
$item2 = $timer->stop('test2);
var_dump($item2->getTime())

统计信息

  • 总下载量: 2.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-03