xdebug on windows使用记录

1.下载xdebug

1
phpinfo();

结果直接从网页上复制到http://xdebug.org/find-binary.php 页面中,获得下载提示及安装说明


2.性能测试

2.1 准备工作
官方文档:

2.1.1在php.ini 中设置
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger = 1 //If it is set to 1, then you can enable the profiler by using a GET/POST or COOKIE variable of the name XDEBUG_PROFILE.

2.1.2下载浏览器插件

2.1.3 下载查看工具
2.1.3.1 使用web查看工具
webgrind安装:

下载,解压缩,然后访问。
配置config.php中的
  • $storageDir - path to a writeable directory where webgrind will store processed cachegrind files
  • $profilerDir - If Xdebug is not installed, this variable defines a directory searched for cachegrind files. If Xdebug is installed, webgrind will look for cachegrind files defined by the xdebug.profiler_output_dir setting. The default is /tmp.
End

附录:
A.
2.1.1及2.1.2英文原文:

Profiling is enabled by setting the xdebug.profiler_enable setting to 1 in php.ini. This instructs Xdebug to start writing profiling information into the dump directory configured with the xdebug.profiler_output_dir directive. The name of the generated file always starts with “cachegrind.out.” and ends with either the PID (process ID) of the PHP (or Apache) process or the crc32 hash of the directory containing the initially debugged script. Make sure you have enough space in your xdebug.profiler_output_dir as the amount of information generated by the profiler can be enormous for complex scripts, for example up to 500MB for a complex application like eZ Publish.

You can also selectively enable the profiler with the xdebug.profiler_enable_trigger setting set to 1. If it is set to 1, then you can enable the profiler by using a GET/POST or COOKIE variable of the name XDEBUG_PROFILE. The FireFox 2 extension that can be used to enable the debugger (see HTTP Debug Sessions) can also be used with this setting. In order for the trigger to work properly, xdebug.profiler_enable needs to be set to 0.
B.
2.1.3英文原文

Xdebug’s Profiler is a powerful tool that gives you the ability to analyze your PHP code and determine bottlenecks or generally see which parts of your code are slow and could use a speed boost. The profiler in Xdebug 2 outputs profiling information in the form of a cachegrind compatible file. This allows you to use the excellent KCacheGrind tool (Linux/Windows, KDE) to analyse your profiling data. If you are on Linux you can install KCacheGrind with your favourite package manager; if you are on Windows you can get precompiled binaries of KCacheGrind at SourceForge.

Users of Windows can also use WinCacheGrind, the functionality is different from KCacheGrind so the section that documents the use of KCacheGrind on this page doesn’t apply to this program. There is also an alternative profile information presentation tool called xdebugtoolkit and a web based front-end called Webgrind.

In case you can not use KDE (or do not want to use KDE) the kcachegrind package also comes with a perl script “ct_annotate” which produces ASCII output from the profiler trace files.

C.
2.1.3.1英文原文
  • Download webgrind.
  • Extract webgrind to a folder accessible to the webserver.
  • Start using webgrind with your browser of choice by navigating to the URL of your webgrind install, e.g. http://localhost/webgrind.
Posted in PHP. Tags: . 没有评论 »

小兔子5个月随想

一眨眼,小兔子已经满5个月了。从小小的6斤,长到了现在的16斤;从刚开始时我都不太敢抱他,到现在抱一会就手酸。

我有时候会很内疚,未满月之前,我一抱他,他就哭,而我不懂得他哭就是要吃奶,我居然没有好好的满足他一下,而是立刻把他换手给爷爷奶奶。有时候很着急,小兔子不肯吃奶,不知道该怎么办才好。有时候很开心,宝宝今天又对我笑了,而且还和我聊天了。各种情绪萦绕在心头,当然,每天开心的时候最多,但是内疚的心情总是很深沉,一旦浮起,总要很久才能散去。

现在一想到宝宝,便是他哈哈笑的样子,我们希望他能够开心快乐的成长,长大之后能够健康开心轻松的生活。

Posted in 宝宝. 2条评论 »

redis资料

最近开始使用redis,应用规模很小,先把学习资料放在这里,以后如果有新的想法再继续补充。

quick start

http://redis.io/topics/quickstart

At this point you can try if your build works correctly typing make test, but this is an optional step. After the compilation the src directory inside the Redis distribution is populated with the different executables that are part of Redis:

  • redis-server is the Redis Server itself.
  • redis-cli is the command line interface utility to talk with Redis.
  • redis-benchmark is used to check Redis performances.
  • redis-check-aof and redis-check-dump are useful in the rare event of corrupted data files.

To start Redis with a configuration file just give the full path of the configuration file to use as the only Redis argument, for instance: redis-server /etc/redis.conf.

redis 维护:

Redis进阶教程-aof(append only file)日志文件

对redis数据持久化的一些想法

redis运用场景:

Redis作者谈Redis应用场景

总的来说,学习时,官方手册为基础,中文blog做补充。

Posted in no-sql. 没有评论 »

CASE WHEN 语句在UPDATE 中的使用

UPDATE SpecialPageProd 
  SET `order`=
  CASE 
      WHEN ChannelID=59 AND ProductID=769713 THEN 1 
      WHEN ChannelID=59 AND ProductID=583738 THEN 2 
      WHEN ChannelID=59 AND ProductID=1047142 THEN 3 
      WHEN ChannelID=59 AND ProductID=1428911 THEN 4 
  END
WHERE work_day = '2007072420'
Posted in mysql. 没有评论 »

2010散记

时间过得真快,一眨眼2010就已经过去了。过去一年发生了什么,都只有模糊的印象了,生活平淡无奇,日复一日。值得一提的是去了趟西安,还在11月的时候有了个大大的惊喜。

有些茫然,有些伤感,时间就这样划过,只留下淡淡的痕迹。只希望忙碌的生活不要让我们迷失自己,忘记本来的梦想与生活的本质。希望生命中最重要的情感不要在繁忙的都市中消磨殆尽,我们能偶尔用纯净的心看看外面。

我们一直羡慕丽江的生活,或许更多的是羡慕那种悠闲自如,随心所欲的境界。

常常在饭团冒泡,常常回忆起过去的那些人和事,泪盈于睫,不知所谓。

Posted in 光阴. 没有评论 »