geekality/timer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

geekality/timer

最新稳定版本:v1.2

Composer 安装命令:

composer require geekality/timer

包简介

Simple class for logging time and memory usage of stuff

README 文档

README

Simple class for logging time and memory usage of methods and such.

The Timer::__toString() method will create a simple plain text overview, but you can of course also create your own output by using the properties of the Timer objects directly.

Installation

If you use Composer, which I highly recommend, simply add the following dependency to your composer.json:

    "require":
    {
    	"geekality/timer": "1.*"
	},

Otherwise just download the file Timer.php from here and include it in your project. It's self-contained so you only need this one file.

Example usage

Timer::start('root');
// Stuff
Timer::start('section');
// Sub section stuff
Timer::stop();
// More stuff
echo Timer::result();

Here is some sample output from the sample/add.php script in this repo.

/TimerPHP/sample/add.php(3, 9)
 │ 
 │ 7.001 s
 │ 4.02 KiB, 732.41 KiB
 │ 
 ├ SlowMath::slowAdd(3, 9)
 │  │ 
 │  │ 4.001 s
 │  │ 432.00 B, 732.41 KiB
 │ ─┘ 
 │ 
 ├ test(null, true, false)
 │  │ 
 │  │ 2.000 s
 │  │ 176.00 B, 732.41 KiB
 │ ─┘ 

If you want to see some more extensive use of this class, you can check out my project, Svish/MyHymnal. There I also dump the result to a file which you can load on the website by clicking a tiny Debug link in the bottom right corner.

License

This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit Creative Commons Attribution 3.0 Unported License.

Creative Commons License

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: CC-BY
  • 更新时间: 2013-04-07