View Issue Details

IDProjectCategoryView StatusLast Update
0002184XdebugProfilingpublic2023-07-04 16:09
Reporterdonquixote Assigned Toderick  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionwon't fix 
Product Version3.2.1 
Summary0002184: Distinguish distinct calls to same function in cachegrind.out file
Description

When viewing profiling data with KCachegrind, I would like to be able to distinguish distinct calls to the same function, if they have a distinct stack trace.
I was wondering if this is even possible with the data recorded in a cachegrind.out.* file, but it seems it is not!

I tried to understand the output of a cachegrind.out.* file and found this:
https://valgrind.org/docs/manual/cl-format.html
Not exactly about xdebug but I think most of what is written there also applies here.

The references from one call to another are like "cfl=(123)" or "cfn=(456)", which references file names and function names, but not individual calls.
Due to this, there is always ambiguity in the call tree.

It would be cool if:

  • xdebug would have an option to add info into the cachegrind.out.* file that references other calls instead of just functions.
  • Later, KCachegrind or other tools could use this information to show a complete call tree.
Additional Information

Interestingly, in the past I used wincachegrind, which seemed to have this functionality.
But I don't know how it extracted that information from a cachegrind.out.* file, which does not really have it.

Tagsprofiling
Operating SystemUbuntu
PHP Version8.2.0-8.2.9

Activities

donquixote

2023-06-29 19:33

reporter   ~0006572

Actually...
can the order of entries be used to resolve ambiguities?

In that case, I could use a script to process and disambiguate, e.g. by appending something to the function names.

And KCachegrind would have the same option.

derick

2023-07-04 16:09

administrator   ~0006577

Hi,

Xdebug's profiler generates the same file format that KCacheGrind/QKcacheGrind expect. I can't just change that as that will break tools that expect these formats.

Although I don't quite understand what you're trying to do here, but if you want a full callgraph, where you can see the structure of calls, which calls what, what arguments and return values are, Xdebug has a "tracer" (https://xdebug.org/docs/trace) which should do exactly all of that. There is a specific format that dumps it in a TSV file, for which you can fairly easily write tools to analyses. The Xdebug source distribution even includes such a script (https://github.com/xdebug/xdebug/blob/master/contrib/tracefile-analyser.php).

I hope that helps!

cheers,
Derick

Issue History

Date Modified Username Field Change
2023-06-29 18:03 donquixote New Issue
2023-06-29 18:03 donquixote Tag Attached: profiling
2023-06-29 19:33 donquixote Note Added: 0006572
2023-07-04 16:09 derick Assigned To => derick
2023-07-04 16:09 derick Status new => resolved
2023-07-04 16:09 derick Resolution open => won't fix
2023-07-04 16:09 derick Note Added: 0006577