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手机设备内核源码的调 ...
随机推荐
- hdu 5533 Dancing Stars on Me
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5533 Dancing Stars on Me Time Limit: 2000/1000 MS (Ja ...
- Objective-C Runtime 运行时之三:方法与消息
基础数据类型 SEL SEL又叫选择器,是表示一个方法的selector的指针,其定义如下: typedef struct objc_selector *SEL; objc_selector结构体的详 ...
- Struts数据效验
表单数据的验证: 前台验证:主要是通过JS验证, 表达数据是否合法! 后台验证:通过后台java代码进行验证! Struts也提供了数据效验的方式! Struts数据效验, 通过拦截器完成: < ...
- 【转载】如何将Emmet安装到到 Sublime text 3?
http://www.cnblogs.com/tinyphp/p/3217457.html 看清楚哦~~这是Sublime text 3不是2的版本,两者的安装还是有区别的,下面的方法是我感觉比较简单 ...
- VPN介绍--虚拟网络
VPN属于远程访问技术,简单地说就是利用公网链路架设私有网络.例如 公司员工出差到外地,他想访问企 原理 业内网的 服务器资源,这种访问就属于远程访问.怎么才能让外地员工访问到内网资源呢?VPN的 ...
- android131 360 05 手势触摸滑动,sim卡,开机启动的广播,手机联系人,SharedPreferences,拦截短信
安卓手势触摸滑动: package com.itheima52.mobilesafe.activity; import android.app.Activity; import android.con ...
- linux内核系统调用和标准C库函数的关系分析
http://blog.csdn.net/skyflying2012/article/details/10044343
- Android_listView_BaseAdapter_downLoadImg
layout.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" x ...
- UTF-8编码与Unicode CS2的转换
/* Convert a UTF-8 string into a UCS-2 array. */ void tcstrutftoucs(const char *str, uint16_t *ary, ...
- sed示例
引用:http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2856901.html [root@www ~]# sed [-nefr] [动作] 选 ...