(Xdebug Profiler) Why are there two cachegrind files generated for one page?

When I enable xdebug profiler, open a page in admin, it generates two cachegrind files with almost identical name

cachegrind.out.1498219635_761795.crown__minilio_wp-admin_edit_php
cachegrind.out.1498219639_141988.crown__minilio_wp-admin_edit_php

The output name is defined as

xdebug.profiler_output_name = "cachegrind.out.%u.%H_%R"

I tried another page, got the same result.

Why is that? Which file should I analysis?

Topic profiling php debug Wordpress performance

Category Web


@Edward,

You've configured the Xdebug profiler output filename in such a way that it overwrites the output file, each time, you run the process.

%u, %H, %R - you mentioned in the output name are called format specifiers.

There are couple of ways to figure out which file you may want to analyze.

  • Use %t (timestamp) format specifier in your output filename so you may know which file to analyze based on the timestamp value.
  • Instead of enabling the profiler throughout, you could trigger the profiler by passing a query arg as described here. This way you will only generate the Xdebug profiler output for the intended page. (Recommended)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.