gajus / xhprof.io

GUI to analyze the profiling data collected using XHProf – A Hierarchical Profiler for PHP.
http://xhprof.io/
Other
429 stars 103 forks source link

allow easy ignore of xhprof itself #18

Open d1rk opened 11 years ago

d1rk commented 11 years ago

I know, it is easy to do on your own:

But if i put the prepend file in my php.ini xhprof itself will also get profiled. That may be a not intended behavior and probably confuses first-time users. I would make a small addition to prevent that to happen or at least easy to suppress.

Probably, it would be enough to define something that stops collection the data in the footer, so one could use it from time to time on their wordpress-installation as well. ;)

define('xhprof_profiling_disabled', true);

or something similar. Should be right within xhprof itself and the footer should ask for it in a non-expecting way.

WDYT?

till commented 11 years ago

I ran into this as well while testing it.

For me, I'd rather like to see something added to the config.inc.php:

array('ignored_functions' => array());

And then xhprof_enable() would use that instead.

I'd also like to see a way to use xhprof_sample_enable(). I can do that by adjusting your prepend file, or using my own, but it could be wrapped into your code-base as well.

WPsites commented 11 years ago

Rather than adding the auto_append_file and auto_prepend_file to your PHP.ini you could just add it to the Apache vhost config just for the websites you would like to profile. Like so:

php_admin_value auto_prepend_file "/var/www/xhprof_io/inc/prepend.php" php_admin_value auto_append_file "/var/www/xhprof_io/inc/append.php"

That way it only profiles selected websites and you'll see no profiles for xhprof.io

staabm commented 11 years ago

@WPsites thats right, but then you need to add this for every vhost (we use 1 vhost per app), so the other way arround would simplify things..

staabm commented 11 years ago

@gajus any preference in the way this could be implemented.. I am willing to spent some time for this

gajus commented 11 years ago

Random thought, though how about adding a simple check if xhprof.inc.php file is in the directory that is executing the script. If the file is there, then reads its content, which could be as simple as <?php return array('enabled' => false);? If this sounds like a reasonable solution, I could add it as soon as tomorrow.

Note, I prefer not to have any XHProf configuration within the file that's being executed. This causes unnecessary noise in version control.

staabm commented 11 years ago

@gajus hmm I think .xhprof.rc would be a better name for such a file, because the way you want it to work sounds for me like most unix tools already do - and there such .rc files are very common

Would you then by default ship xhprofio with a .xhprof.rc which disables profiling within the UI by default?

staabm commented 11 years ago

prepared a PR for that. see #40

staabm commented 10 years ago

this issue is fixed in https://github.com/staabm/xhprof.io