colindecarlo / jank-profiler
当您不想费心研究分析器时的分析器。
0.2.0
2015-03-07 00:01 UTC
Requires
- php: >=5.6.0
This package is not auto-updated.
Last update: 2024-09-14 15:40:44 UTC
README
当您不想费心研究真正的分析器时。
使用Jank Profiler将您的应用程序中的单个对象包装起来,以跟踪该对象公共API中的方法调用内存使用和执行时间。
用法
假设您的应用程序中有些代码如下
$myQuestionableObject = new WhompWhompDoDad(['thinger_option_x' => true]); $whompTimes = 3; $myQuestionableObject->whomp($whompTimes); $myQuestionableObjecct->doDad();
您可以像这样对WhompWhompDoDad
实例进行jank分析
$myQuestionableObject = new JankProfiler('WhompWhompDoDad', [['thinger_option_x' => true]]); $whompTimes = 3; $myQuestionableObject->whomp($whompTimes); $myQuestionableObjecct->doDad(); echo $myQuestionableObject->report('json') . "\n"; exit;
这将产生类似以下的JSON输出
[
{
"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
}
]
非常棒!
作者
Colin DeCarlo,colin@thedecarlos.ca
许可协议
Jank Profiler遵循MIT许可协议 - 详细信息请参阅LICENSE文件