satmaelstorm/ts-profiler
最新稳定版本:1.2.1
Composer 安装命令:
composer require satmaelstorm/ts-profiler
包简介
Tiny and simple profiler
关键字:
README 文档
README
Tiny and Simple PHP-runtime Profiler
This component allows you to profile the code directly in the production environment.
You can use it as a Singleton:
$profiler = ProfilerSingletone::getInstance();
Also, if you want disable profiling at this time, you can use:
$profiler = ProfilerSingletone::getInstance(false);
So, if you don't want use Singleton, you can use:
$profiler = new Profiler();
or
$profiler = new Profiler(false);
when you don't need profiler at this time
This case very useful, when you want to use TSProfiler as Symfony service, or in another framework, which will ensure the uniqueness of the existence of a class instance.
For profiling, trackers are created using the addTracker method. Each tracker can store data in its own way. The profiling data will save the class that implements the ShutdownInterface interface. You can write any plug-in - save with sql-server, file, Monolog or some other way.
$tracker = $profiler->addTracker($name, $saver);
If you want disable this tracker at this time:
$tracker = $profiler->addTracker($name, $saver, false);
Example with CSVSaver class:
$tracker = $profiler->addTracker( 'csvTracker', new \satmaelstorm\TSProfiler\TSProfilerShutdown\CSVSaver('\tmp'); );
After creating the tracker, you wrap the profiled lines using the startJob and stopJob methods of the tracker.
$tracker->startJob('jobName'); //profiled code $tracker->stopJob('jobName');
统计信息
- 总下载量: 9.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-22