Clearing XHProf Data not working

1.2k Views Asked by At

I got XHProf working with XHgui. I like to clear or restart fresh profiling for certain site or globally. How do i clear/reset XHprof? I assume i have to delete logs in Mongo DB but I am not familiar with Mongo and I don't know the tables it stores info.

2

There are 2 best solutions below

0
On

To clear XHProf with XHGui, log into mongo db and clear the collection - results as following:

mongo
db.results.drop()

The first line log into mongo db console. The last command, drops collection results that is is going to be recreated by the XHGui on the next request that is profiled

Some other useful commands:

show collections //shows all collection
use results //the same meaning as mysql i believe
db.results.help() //to find out all commands available for collection results

I hope it helps

0
On

I have similar issue in my Drupal setup, using Devel module in Drupal. After a few check & reading on how xhprof library save the data, i'm able to figure out where the data is being saved.

The library will check is there any defined path in php.ini

xhprof.output_dir

if there's nothing defined in your php.ini, it will get the system temp dir.

sys_get_temp_dir()

In short, print out these value to find the xhprof data: $xhprof_dir = ini_get("xhprof.output_dir"); $systemp_dir = sys_get_temp_dir();

if $xhprof_dir doesn't return any value, check the $systemp_dir, xhprof data should be there with .xhprof extension.