Madrid/bench

测量两个或多个点之间经过的时间、内存(服务器负载)的基准测试/分析实用类。

1.0.0 2020-08-21 22:07 UTC

This package is auto-updated.

Last update: 2024-09-23 04:51:49 UTC


README

(基准测试/分析/计时)类,用于测量两个(或更多)点之间经过的时间、内存(服务器负载)。

安装

"require": {
   "maddrid/bench": "dev-master"
  }

用法

尽可能简单

use Maddrid\Bench as Bench ;

Bench::start('first_point');
  do_some_math
    Bench::start('second_point');
      do_more_math
    Bench::stop('second_point');
    Bench::start('third_point');
      do_more_math
    Bench::stop('third_point');
Bench::stop('first_point');

显示

//更多详情

Bench::printTimers(true);

保持简单

Bench::printTimers();

获取计时器

Bench::getTimers();
Bench::getTimers(null);
Bench::getTimers(true);
Bench::getTimers(null,5);
Bench::getTimers(true,5);

停止计时器

Bench::stop('first_point'); 

//将获取服务器负载

Bench::stop('first_point',true);

已知事实

获取服务器负载时

Bench::stop('first_point',true);

将在检查点处添加额外的秒数。如果检查点是嵌套的,"父级"检查点将继承这些秒数。