定制 bitandblack/measurement 二次开发

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

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

bitandblack/measurement

最新稳定版本:2.2.0

Composer 安装命令:

composer require bitandblack/measurement

包简介

Simple PHP code time measurement

README 文档

README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black Logo

Bit&Black Measurement

Simple PHP code time measurement. Using time units allows receiving information about the start time and end time of a unit and also its execution length in total seconds and in percent.

If angle/chrono is the easiest way, this is the second easiest.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/measurement.

Usage

Set up a new Measurement object once:

<?php 

use BitAndBlack\Measurement\Measurement;

$measurement = new Measurement();

Create a Unit object for every part you want to measure, add it to the measurement object and start the measurement:

<?php 

use BitAndBlack\Measurement\Unit;

$unit = new Unit('Sample Unit');

$measurement->add(
    $unit->start()
);

When you want to end the measurement of a unit, call $unit->end().

To receive the information about all your units, call $measurement->getSummary(). In out example, this would get something like:

Array
(
    [0] => Array
        (
            [description] => Sample Unit
            [started] => object(DateTime) // 2022-07-04 07:08:38.032900
            [ended] => object(DateTime) // 2022-07-04 07:08:40.035100
            [tookTime] => 2.0021901130676
            [tookPercent] => 100
        )
)

Each unit object stores its own information, that can be access by regular getter methods. So you can access them for example like that:

<?php 

var_dump('Sample Unit took ' . $unit->getTime() . ' seconds.');

Help

If you have any questions, feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固