# Patch and RFC for adding DTrace probes to PHP

- Thread: https://externals.io/message/44964
- Original archive: https://news-web.php.net/php.internals/44964
- Started by David Soria Parra on 2009-07-14T21:31:26+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #44964 — David Soria Parra — 2009-07-14T21:31:26+00:00

URL: https://externals.io/message/44964#44964

Hi List,

in the last months I worked on adding DTrace probes to PHP and would
like to start a discussion about the RFC and patch against trunk
that can be found at:

 http://wiki.php.net/rfc/dtrace

DTrace is a dynamic tracing framework for Solaris, OpenSolaris, Mac OSX
and FreeBSD that can be used to trace running applications on a system
based on instrumentation points in the kernel and the application. The
patch aims to include static probes into PHP which will better reflect
PHP execution from a user persective. At the moment PHP can only be
traced with deep knowledge of the executor and it's functions.

The patch is based on recent trunk and can be found at:

 http://patches.experimentalworks.net/dtrace.patch

In the current state the patch introduces a wrapper for the current
executor to fire function-entry probes. It was mentioned that it might
be useful to not use an own funciton for that. As I want to make things
cleaner for the current state of review, I decided to use a separate
function.

The patch was tested on Mac OS 10.5, Solaris 10 and OpenSolaris 2009.06.

David

---

## #44965 — Andrei Zmievski — 2009-07-14T21:59:52+00:00

URL: https://externals.io/message/44964#44965 · In reply to: #44964

On Tue, Jul 14, 2009 at 2:31 PM, David Soria Parra <david.soriaparra@sun.com
> wrote:

> In the current state the patch introduces a wrapper for the current
> executor to fire function-entry probes. It was mentioned that it might
> be useful to not use an own funciton for that. As I want to make things
> cleaner for the current state of review, I decided to use a separate
> function.
>
> The patch was tested on Mac OS 10.5, Solaris 10 and OpenSolaris 2009.06.
>

I believe I said this already, but I'm for this going into HEAD.

-Andrei

---

## #44969 — Sriram Natarajan — 2009-07-14T22:52:37+00:00

URL: https://externals.io/message/44964#44969 · In reply to: #44964

David
 I have been talking with some Drupal users and some of them showed lot 
of interest to be able to print out the function arguments as well as 
part of DTrace function-entry probes.

- Sriram

David Soria Parra wrote:
> Hi List,
>
> in the last months I worked on adding DTrace probes to PHP and would
> like to start a discussion about the RFC and patch against trunk
> that can be found at:
>
>  http://wiki.php.net/rfc/dtrace
>
> DTrace is a dynamic tracing framework for Solaris, OpenSolaris, Mac OSX
> and FreeBSD that can be used to trace running applications on a system
> based on instrumentation points in the kernel and the application. The
> patch aims to include static probes into PHP which will better reflect
> PHP execution from a user persective. At the moment PHP can only be
> traced with deep knowledge of the executor and it's functions.
>
> The patch is based on recent trunk and can be found at:
>
>  http://patches.experimentalworks.net/dtrace.patch
>
> In the current state the patch introduces a wrapper for the current
> executor to fire function-entry probes. It was mentioned that it might
> be useful to not use an own funciton for that. As I want to make things
> cleaner for the current state of review, I decided to use a separate
> function.
>
> The patch was tested on Mac OS 10.5, Solaris 10 and OpenSolaris 2009.06.
>
> David

---

## #44970 — Alexey Zakhlestin — 2009-07-15T06:01:54+00:00

URL: https://externals.io/message/44964#44970 · In reply to: #44964

On Wed, Jul 15, 2009 at 1:31 AM, David Soria
Parra<david.soriaparra@sun.com> wrote:
> Hi List,
>
> in the last months I worked on adding DTrace probes to PHP and would
> like to start a discussion about the RFC and patch against trunk
> that can be found at:
>
>  http://wiki.php.net/rfc/dtrace
>
> DTrace is a dynamic tracing framework for Solaris, OpenSolaris, Mac OSX
> and FreeBSD that can be used to trace running applications on a system
> based on instrumentation points in the kernel and the application.

Also, there is an ongoing effort of adding DTrace support to linux.
Blog of the author: http://www.crisp.demon.co.uk/blog/index.html

> The patch aims to include static probes into PHP which will better reflect
> PHP execution from a user persective. At the moment PHP can only be
> traced with deep knowledge of the executor and it's functions.
>
> The patch is based on recent trunk and can be found at:
>
>  http://patches.experimentalworks.net/dtrace.patch
>
> In the current state the patch introduces a wrapper for the current
> executor to fire function-entry probes. It was mentioned that it might
> be useful to not use an own funciton for that. As I want to make things
> cleaner for the current state of review, I decided to use a separate
> function.
>
> The patch was tested on Mac OS 10.5, Solaris 10 and OpenSolaris 2009.06.

The patch is simple and clean. Just 2 notices..
1) Zend/zend_dtrace.h file is generated. Are you sure it should be the
part of patch?
2) Probes would benefit from having more details (exception-messages,
function-arguments, etc.)

Other than that, I am all for including this in trunk. Earlier we have
it — earlier we can start tuning it :)

-- 
Alexey Zakhlestin
http://www.milkfarmsoft.com/

---

## #44971 — David Soria Parra — 2009-07-15T07:16:18+00:00

URL: https://externals.io/message/44964#44971 · In reply to: #44970

> The patch is simple and clean. Just 2 notices..
> 1) Zend/zend_dtrace.h file is generated. Are you sure it should be the
> part of patch?

The generated dtrace header on Solaris and MacOS are different.
Therefore people have to generate them during configure and then cannot
copy&paste sources to another machine and build, that's why the provided
zend_dtrace.h includes both variants of the header file and is included
in the patch.

---

## #44972 — Alexey Zakhlestin — 2009-07-15T07:46:45+00:00

URL: https://externals.io/message/44964#44972 · In reply to: #44971

On Wed, Jul 15, 2009 at 11:16 AM, David Soria
Parra<david.soriaparra@sun.com> wrote:
> 
> > […]
>
> The generated dtrace header on Solaris and MacOS are different.
> Therefore people have to generate them during configure and then cannot
> copy&paste sources to another machine and build, that's why the provided
> zend_dtrace.h includes both variants of the header file and is included
> in the patch.

The problem is, that if we update Zend/zend_dtrace.d, this header file
will need to be regenerated.
So, there is a need for a corresponding procedure.

-- 
Alexey Zakhlestin
http://www.milkfarmsoft.com/

---

## #44973 — David Soria Parra — 2009-07-15T07:53:26+00:00

URL: https://externals.io/message/44964#44973 · In reply to: #44972

> The problem is, that if we update Zend/zend_dtrace.d, this header file
> will need to be regenerated.
> So, there is a need for a corresponding procedure.

I'll change the patch as soon as possible to generate the header file
during configure.

---

## #44995 — David Soria Parra — 2009-07-16T22:21:29+00:00

URL: https://externals.io/message/44964#44995 · In reply to: #44964

> Hi List,
>
> in the last months I worked on adding DTrace probes to PHP and would
> like to start a discussion about the RFC and patch against trunk
> that can be found at:
>
>  http://wiki.php.net/rfc/dtrace

If there are no other objects I will commit the patch with the small
modification that zend_dtrace.h is generated during configure in the
next days, unless someone want to do an explicit voting on that rfc.
