ceefour/wincachegrind

Inaccurate measurements of time (under some/all conditions?)

Opened this issue · 6 comments

From Ephraim Rubenstein effyruby@gmail.com :

I downloaded 3 Cachegrind viewers today.

  1. WebCacheGrind 1.1.0.16
  2. WebGrind and
  3. QCacheGring

WebCacheGrind is showing measurements approx 1/10 of the other 2

WebCacheGrind Zend\MVC\Application->init 49ms
WebGrind 492ms and
QCacheGrind 492 253 (microsecs)

This does not make sense .

Can you advise?

TIA

Efffy

bbak commented

Same here. Version 1.0.0.14 (last one on Sourceforge) reports 9731 ms and current 1.1 973ms on the same .out file. A xdebug Profile is also ~ 9 Sec.

I can confirm, 1.10.16 shows 14ms, while 1.0.0.14 shows 142ms.

1.0.0.14 above image, 1.10.16 below
cachegrind

Same here

I don't know when or if there'll be a fix.
Feel free to use an older version at https://github.com/ceefour/wincachegrind/releases

I can confirm the problem with the latest version. All times are 1/10 of the times in the cachegrind files. You can easily test it with just sleep(1) in a php file.
Funny enough, the problem is well kown since at least 8 years. See the issues at Sourceforge: https://sourceforge.net/p/wincachegrind/bugs/2/
Merijn Bosma said there, that he has fixed the issue in release 10.0.0.14. So someone has "fixed" it back.
It's even possible to work with that issue, but how hard could it be to add a multiplier of 10 to the times? Just an idea.

Xdebug 3.1.6 is using 10ns units, and the millisecond calculations are perfectly fine in WinCachegrind 1.1.0.16.

FYI the problematic cachegrind file in the linked bug is oddly using 1 microsecond units, and is specifying it as "Time" in the header. Looks like WinCacheGrind is assuming 10ns units by default, maybe it is ignoring the unit defined in the events header? I think it would be great if the unit should just be configurable, no reason to try to autodetect it from the header.

I can confirm that everything looks great when I am looking at cachegrind files generated with Xdebug 3.1.6.
Everyone should update Xdebug to the latest version that is supported by their PHP version, as WinCacheGrind will show the proper values when the cachegrind file is using 10ns units:
https://xdebug.org/docs/compat

Actually, Webgrind is off by the fraction of 10 since this Xdebug PR was released:
xdebug/xdebug#619

QCacheGrind/KCacheGrind are just using the raw values, so they are totally unreadable due to printing the 10ns units as is.