0

I need to see how much each page has used resources and what page is the biggest resource taker. Thank you.

Emre Yazici
  • 10,136
  • 6
  • 48
  • 55
good_evening
  • 21,085
  • 65
  • 193
  • 298
  • What do you mean by "each page" exactly? Are you referring to PHP processes that are currently running? – Pekka Feb 06 '11 at 12:19
  • @Pekka: I don't know. I want to see which queries or pages take the most resources. – good_evening Feb 06 '11 at 12:30
  • @hey what resources exactly? Memory? Hard disk? You'll have to clarify before anybody can give a meaningful answer. Also, the way many PHP based systems work nowadays, there are no "pages" anymore, but one index.php front controller that serves *everything*. What would you want to measure in that context exactly and how?... Maybe ask from a different angle and explain why you need this, maybe there are other approaches. – Pekka Feb 06 '11 at 12:32
  • @Pekka: I want to see queries which takes the most resources. I don't know is it memory, or hard disk. I want to see which queries I should optimize more. – good_evening Feb 06 '11 at 12:35
  • @hey okay maybe edit that into the question. And to clarify, you are on shared hosting with this? You have no access to the mySQL server itself? – Pekka Feb 06 '11 at 12:39

1 Answers1

0

So in essence you are looking for something like mod_profiling? Don't google. Fictional example. There is nothing like that.

But if this is strictly about PHP pages you could very well setup xdebug and enable the profiler to auto-generate memory usage and runtime dumps. http://www.xdebug.org/docs/profiler

It's best not to uniliterally enable this on a production system, but the configuration option xdebug.profiler_enable_trigger allows you to trigger it individually for each request with and &XDEBUG_PROFILE=1 parameter. Use http://www.xdebug.org/docs/all_settings#trace_output_name to set a per-page profiler output filename. As for evaluation, you have to go manually trough the pages to generate dumps, and manually inspect them (kcachegrind or similiar tools).

You can see the runtime of mysql_queries() right there, but not the resource usage for the Mysql server itself. The convenient show-me-all profiling solution does not exist. Query optimization is again a programming task. http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html

mario
  • 144,265
  • 20
  • 237
  • 291