php ticks 调试应用
declare(ticks=1);register_tick_function('do_profile');register_shutdown_function('show_profile');$profile = array();$last_time = microtime(true);a();function do_profile() { global $profile, $last_time; $bt = debug_backtrace(); if (count($bt) <= 1) { return ; } $frame = $bt[1]; unset($bt); $function = $frame['function']; if (!isset($profile[$function])) { $profile[$function] = array( 'time' => 0, 'calls' => 0 ); } $profile[$function]['calls']++; $profile[$function]['time'] += (microtime(true) - $last_time); $last_time = microtime(true);}function show_profile() { global $profile; print_r($profile);}function a() { usleep(50 * 1000); b();}function b() { usleep(500 * 1000); c();}function c() { usleep(5000 * 1000);} |
输出:
Array( [a] => Array ( [time] => 0.0511748790741 [calls] => 2 ) [b] => Array ( [time] => 0.500598907471 [calls] => 2 ) [c] => Array ( [time] => 5.00052690506 [calls] => 1 ))php ticks 调试应用的更多相关文章
- NodeJS的代码调试和性能调优
本文转自我的个人博客. NodeJS 自 2009 年显露人间,到现在已经六个年头了,由于各种原因,中间派生出了个兄弟,叫做 iojs,最近兄弟继续合体,衍生出了 nodejs4.0 版本,这东西算是 ...
- WinDbg调试CPU占用高的问题 试验+实战 《第七篇》
一.High CPU试验 1.示例代码 static void Main(string[] args) { Console.Clear(); Console.WriteLine("到命令行下 ...
- php declare (ticks = N)
A tick is an event that occurs for every N low-level tickable statements executed by the parser with ...
- Windbg在软件调试中的应用
Windbg在软件调试中的应用 Windbg是微软提供的一款免费的,专门针对Windows应用程序的调试工具.借助于Windbg, 我们常见的软件问题:软件异常,死锁,内存泄漏等,就可以进行高效的排查 ...
- Windbg内核调试之三: 调试驱动
这次我们通过一个实际调试驱动的例子,来逐步体会Windbg在内核调试中的作用.由于条件所限,大多数情况下,很多人都是用VMware+Windbg调试内核(VMware的确是个好东西).但这样的调试需要 ...
- 【php学习笔记】ticks篇
1. 什么是ticks 我们来看一下手冊上面对ticks的解释: A tick is an event that occurs for every N low-level statements exe ...
- 使用WinDbg内核调试[转]
Technorati 标签: windbg,内核调试 WINDOWS调试工具很强大,但是学习使用它们并不容易.特别对于驱动开发者使用的WinDbg和KD这两个内核调试器(CDB和NTSD是用户态调试器 ...
- 修改公司VS_UCOS工程BUG调试过程说明
说明:公司里的工程中,使用VS_UCOS来调试应用程序.业务逻辑.方法是嵌入式和VS分别建一个工程,把底层驱动部分分别添加各自需要的源文件,头文件使用同一个.也就是嵌入式的驱动函数名和参数和VS的函数 ...
- Android内核的编译和调试
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/70500488 一.Android内核源码的选择 Android手机设备内核源码的调 ...
随机推荐
- springMVC get请求及其请求地址写法
今天,需要写一个接口,写完之后,测试的时候发线一直报404错误,不知道为什么报错.应该是get请求地址的问题,get请求有两个参数,改为一个参数的时候是好用的,可能那种方式不适合写两个参数的get请求 ...
- [MODx] 7. MIGX DB
MODx provides a really unfriendly way to work with xPDO class. What I means is you need to define XM ...
- eclipse安装android sdk后工具栏没有图标的设置
如果没有出现这android图标,选择'Window>Customize Perspective...>Commands',并在'Available command groups'中勾选' ...
- php中global和$GLOBALS[]的分析之一
PHP 的全局变量和 C 语言有一点点不同,在 C 语言中,全局变量在函数中自动生效,除非被局部变量覆盖 这可能引起一些问题,有些人可能漫不经心的改变一个全局变量.PHP 中全局变量在函数 ...
- Asp.Net 之 下载文件的常用方式
1.直接使用Response.TransmitFile(filename)方法 protected void Button_Click(object sender, EventArgs e) { /* ...
- Markdown基础语法
Markdown 的优点如下: 纯文本,所以兼容性极强,可以用所有文本编辑器打开. 让你专注于文字而不是排版. 格式转换方便,Markdown 的文本你可以轻松转换为 html.电子书等. Markd ...
- RESTful HTTP实践
http://www.infoq.com/cn/articles/designing-restful-http-apps-roth 摘要: 本文对RESTful HTTP的基础原理做了一个概览,探讨了 ...
- debian 开启SSH
1.修改sshd_config文件,命令为:vi /etc/ssh/sshd_config 2.将#PasswordAuthentication no的注释去掉,并且将NO修改为YES //我的ka ...
- Android 自学之星级评分条RatingBar
星级评分条(RatingBar)与拖动条十分相似,他们还有共同的父类AbsSeekBar.实际上星级评分条和拖动条的用法和功能都十分的接近:他们都允许用户通过拖动来改变进度.RatingBar与See ...
- LogstashL reference 重要章节
配置文件结构说明 https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html Event相关配 ...