The Observation Deck

Search
Close this search box.

DTrace and PHP

August 4, 2005

Tonight during our OpenSolaris BOF at OSCON, PHP core developer Wez Furlong was busy adding a DTrace provider to PHP. After a little bit of work (and a little bit of debugging), we got it working — and damn is it cool. Wez implemented it as a shared object, which may then be loaded via an explicit extension directive in php.ini. Once loaded, two probes show up: function-entry and function-return. These probes have as their arguments a pointer to the function name, a pointer to the file name, and a line number. This allows one to, for example, get a count of all PHP functions being called:

# dtrace -n function-entry'{@[copyinstr(arg0)] = count()}'

Or you can aggregate on file name and quantize by line number:

# dtrace -n function-entry'{@[copyinstr(arg1)] = lquantize(arg2, 0, 5000)}'

Or you can determine the amount of wall time taken by a given PHP function:

# dtrace -n function-entry'/copyinstr(arg0) == "myfunc"/{self->ts = timestamp}'
-n function-return'/self->ts/{@ = avg(timestamp - self->ts); self->ts = 0)}'

And because it’s DTrace, this can all be done on a production box — and without regard to the number of PHP processes. (So if you have 200 Apache processes handling PHP, the above invocations would aggregate across them.) When I get back, I’ll download Wez’s provider and post some more comprehensive examples. In the meantime, if you’re a PHP developer at OSCON, stop Wez if you see him and ask him to give you a demo — it’s the kind of thing that needs to be seen to be appreciated…

Finally, if you’re interested in adding your own DTrace provider to the application, language or system that you care about, be sure to check out my presentation on DTrace tomorrow at 4:30 in Portland room 255. (Hopefully this time I won’t be tortured by memories of being mindfucked by Inside UFO 54-40.)

15 Responses

  1. You can now install the package using the pear tool:

    # pear install dtrace
    # echo “extension=dtrace.so” >> $prefix/lib/php.ini

    where $prefix is the prefix you used to configure your php install.

  2. [b]香港会计事务所
    [b]日聪注册香港公司
    登尼特香港公司注册香港登尼特:专业公司注册、香港公司注册,上海公司注册,美国公司注册,注册深圳公司,中国及海外公司.
    登尼特注册香港公司香港登尼特:专业注册公司、注册香港公司,注册上海公司,注册美国公司,注册深圳公司,中国及海外公司,香港公司注册,深圳公司注册,上海公司注册,中国公司注册。
    上海企业注册中心,专业香港公司注册主要提供香港公司注册、香港公司注册咨询,香港公司注册代办,香港公司注册办理,香港公司注册银行开户,商务秘书等一条龙服务。香港公司注册登记处,致力于注册香港公司、工商企业登记、香港会计税务、香港律师咨询等服务,是香港政府唯一的工商企业登记注册机构
    登尼特注册香港公司专业注册香港公司,权威全球公司注册,注册英、美、BVI公司,中国及全球商标注册.

  3. 登尼特北京香港公司注册
    上海公司注册中心专业注册香港公司海外公司注册、深圳公司注册、香港公司注册、注册公司、注册商标及提供注册公司的配套服务,公司注册成立后是企业运作的开始,注册香港公司电话:0755-82143660刘小姐
    登尼特注册香港公司专业服务,包括注册香港公司价格咨询,注册香港公司知识,注册香港公司的优势及发展,有需要注册香港公司的欢迎和我们联系。0755-82143660刘小姐
    海鸥注册香港公司简况,香港公司注册:包括公司名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓、代付香港公司注册费用、标准章一枚、香港公司注册更改章一枚。本公司提供一切香港公司注册的业务活动。香港公司注册电话:0755-82143660刘小姐
    波仕达会计事务所专业注册香港公司服务:*注册香港公司咨询,*注册香港公司服务,本公司提供一切条件方便客户;

  4. 登尼特香港公司注册咨询
    登尼特香港公司注册,香港公司注册:包括香港公司注册名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓。
    登尼特注册香港公司条件
    波仕达香港公司注册
    [b]日聪专业注册香港公司海外公司注册、深圳公司注册、香港公司注册、注册公司、注册商标及提供注册公司的配套服务,公司注册成立后是企业运作的开始,注册香港公司电话:0755-82143660刘小姐
    日聪香港公司注册简况,香港公司注册:包括公司名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓、代付香港公司注册费用、标准章一枚、香港公司注册更改章一枚。本公司提供一切香港公司注册的业务活动。香港公司注册电话:0755-82143660刘小姐

  5. 日聪专业提供深圳注册香港公司服务:*注册香港公司咨询,*注册香港公司服务,本公司提供一切条件方便客户;
    日聪香港公司注册
    香港日聪注册香港公司、海鸥注册香港公司、登尼特注册香港公司、瑞丰注册香港公司、东莞注册香港公司、上海注册香港公司、代理注册香港公司、注册香港公司留言、香港公司注册处。
    登尼特注册香港公司 香港登尼特:专业注册公司、注册香港公司,注册上海公司,注册美国公司,注册深圳公司,中国及海外公司,香港公司注册,深圳公司注册,上海公司注册,中国公司注册。[b]
    Piers

  6. [b]香港登尼特专业注册公司提供注册公司咨询0755-82143181
    [b]登尼特专业注册公司提供注册公司咨询0755-82143181
    [b]香港日聪专业注册公司提供注册公司咨询0755-82143181
    [b]登尼特专业注册公司提供注册公司咨询0755-82143181
    香港海鸥注册公司提供公司注册咨询0755-82143272
    [b]登尼特专业公司注册提供公司注册咨询0755-82143181
    [b]登尼特专业公司注册提供公司注册咨询0755-82143181
    [b]香港日聪专业公司注册提供注册公司咨询0755-82143181
    [b]登尼特专业公司注册提供注册公司咨询0755-82143181

  7. [b]香港日聪专业公司注册提供注册公司咨询0755-82143181
    [b]登尼特专业公司注册提供注册公司咨询0755-82143181
    香港日聪商标事务所专业注册商标,包括注册香港商标,注册中国商标,注册海外商标,马德里商标注册,商标买卖,商标异议,品牌规划,商标注册,专利申请,版权登记等服务。中国区电:0755-82143272,atahkhk@21cn.com
    香港日聪商标注册网,免费提供商标注册信息查询,根据国际惯例,查询所涉及的商标注册信息仅供参考,无任何法律效力。尽管如此,国家工商行政管理总局商标局仍会尽最大努力向中外公众提供尽可能准确的商标注册信息,并及时更新商标注册数据库信息。
    登尼特专业注册公司
    香港日聪商标事务所专业注册香港商标
    香港日聪商标事务所专业香港商标注册
    香港日聪商标事务所专业中国商标注册
    香港日聪商标事务所专业注册中国商标

Leave a Reply

Recent Posts

November 18, 2023
November 27, 2022
October 11, 2020
July 31, 2019
December 16, 2018
September 18, 2018
December 21, 2016
September 30, 2016
September 26, 2016
September 13, 2016
July 29, 2016
December 17, 2015
September 16, 2015
January 6, 2015
November 10, 2013
September 3, 2013
June 7, 2012
September 15, 2011
August 15, 2011
March 9, 2011
September 24, 2010
August 11, 2010
July 30, 2010
July 25, 2010
March 10, 2010
November 26, 2009
February 19, 2009
February 2, 2009
November 10, 2008
November 3, 2008
September 3, 2008
July 18, 2008
June 30, 2008
May 31, 2008
March 16, 2008
December 18, 2007
December 5, 2007
November 11, 2007
November 8, 2007
September 6, 2007
August 21, 2007
August 2, 2007
July 11, 2007
May 20, 2007
March 19, 2007
October 12, 2006
August 17, 2006
August 7, 2006
May 1, 2006
December 13, 2005
November 16, 2005
September 13, 2005
September 9, 2005
August 21, 2005
August 16, 2005

Archives