定制 colindecarlo/jank-profiler 二次开发

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

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

colindecarlo/jank-profiler

最新稳定版本:0.2.0

Composer 安装命令:

composer require colindecarlo/jank-profiler

包简介

A profiler for when you don't want to figure out profilers.

README 文档

README

For when you don't want to figure out actual profilers.

Use Jank Profiler to wrap individual objects in your application to track memory usage and execution time of method calls belonging to that objects public api.

Usage

Let's say you have some code in your application that looks like this:

$myQuestionableObject = new WhompWhompDoDad(['thinger_option_x' => true]);
$whompTimes = 3;
$myQuestionableObject->whomp($whompTimes);
$myQuestionableObjecct->doDad();

you can jank profile the WhompWhompDoDad instance like this:

$myQuestionableObject = new JankProfiler('WhompWhompDoDad', [['thinger_option_x' => true]]);
$whompTimes = 3;
$myQuestionableObject->whomp($whompTimes);
$myQuestionableObjecct->doDad();

echo $myQuestionableObject->report('json') . "\n"; exit;

This will produce JSON output similar to:

[
    {
        "type": "construct",
        "meta": {
            "classname": "WhompWhompDoDad",
            "constructor_args": [
                {
                    "thinger_option_x":  true
                }
            ]
        },
        "memory_before": 464280,
        "start_time": 1425158122.1155,
        "memory_after": 477968,
        "end_time": 1425158122.116
    },
    {
        "type": "method call",
        "meta": {
            "method": "whomp",
            "arguments": [
                3
            ]
        },
        "start_time": 1425158122.116,
        "memory_before": 479896,
        "end_time": 1425158122.116,
        "memory_after": 480312
    },
    {
        "type": "method call",
        "meta": {
            "method": "doDad",
            "arguments": []
        },
        "start_time": 1425158122.116,
        "memory_before": 481976,
        "end_time": 1425158122.116,
        "memory_after": 482344
    }
]

Pretty neat!

Author

Colin DeCarlo, colin@thedecarlos.ca

License

Jank Profiler is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-28