Re: Req #16625 [Opn]: Allow use of CPU cycles instead of time
| From: | Changhao Jiang | Date: | Sun, 14 Jun 2009 13:12:30 +0000 |
| Subject: | Re: Req #16625 [Opn]: Allow use of CPU cycles instead of time | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6473@lists.php.net to get a copy of this message | ||
I am not convinced that RDTSC counter comparison is useful either. Based on
our own experience that a significant portion of a PHP request processing
time is spent on external IO (database queries, memcache accesses, etc.).
Suppose we compare RDTSC counter values directly, and the CPU frequency is
downclocked with SpeedStep by half, even if nothing has changed in the
execution time, direct RDTSC counter comparison would lead to the wrong
conclusion that external IO operations were sped up by two times.
thanks,
-Changhao
On Sun, Jun 14, 2009 at 4:38 AM, karsten at typo3 dot org <
pecl-dev@lists.php.net> wrote:
> Edit report at
> http://pecl.php.net/bugs/bug.php?id=16625&edit=1
>
> ID: 16625
> User updated by: karsten at typo3 dot org
> Reported By: karsten at typo3 dot org
> Status: Open
> Id: 16625
> Type: Feature/Change Request
> Package: xhprof
> Operating System: OS X (Leopard)
> PHP Version: 5.3.0RC2
> New Comment:
>
> Well, sleep() calls are hardly something one wants to
> profile... :)
>
> I saw that you use the RDTSC counter, but calculate time using
> the CPU frequency inside the xhprof extension. If you just
> left that out, it would no longer be required to disable
> speedstep and numbers would be comparable even across
> different machines.
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2009-06-11 18:48:20] kannan at php dot net
>
> I don't think it fixes the issue. A program which does say a sleep(1)
> would still report different number of cycles when SpeedStep is on.
>
> [Note: We are using CPU cycles (RDTSC counter) as a way to do "elapsed"
> time (or wall clock time) profiling. If what you are interested in is
> CPU time, then xhprof_enable() already takes an option flag for CPU time
> profiling-- namely, XHPROF_FLAGS_CPU. When XHPROF_FLAGS_CPU flag is
> used, CPU times are measured using getrusage().]
>
> Let me know if I misunderstood your suggestion.
>
> ------------------------------------------------------------------------
>
> [2009-06-11 08:17:41] karsten at typo3 dot org
>
> Description:
> ------------
> The use of time when profiling is always error-prone
> (SpeedStep, comparability across systems). It would be cool to
> use CPU cycles instead of microseconds, at least that could be
> an option.
>
> ------------------------------------------------------------------------
>
>
> --
> Edit this bug report at
> http://pecl.php.net/bugs/bug.php?id=16625&edit=1
>
>