NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Profiling feature w/ database queries


Joined: 30 Oct 2004
Posts: 8
Reply with quote
Hello,

I'm trying to use the profiler feature. All of my database queries go through a central database class. The query function in this class is shown as the highest time in the profiler, but I can't tell which queries took the longest. I can see how to switch to "lines by routine", which shows each time the query function was run and how long each took, but I can't tell what the query parameter value is, or even what line of code called the function in order to tell which queries are the slowest. How would I be able to find this?

Thanks.
View user's profileFind all posts by cayatesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Profiler shows how fast or slow a given chunk of code in general with certain degree of granularity in time and in source lines.
It does not let your explore performance of individual hits with their contexts and data. What you asking about is a tracing functionality and is not supported at the moment. Yet.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 30 Oct 2004
Posts: 8
Reply with quote
ah, crap. That was the main reason I bought this, I guess I should have asked questions first. Any idea on how long that feature might take to be added? Is it planned for the next version, or the next major release? If so, will that be first quarter next year, etc?

One way that I was able to accomplish what I was looking for was to use the debug+profile, set a breakpoint in the query function, check the value of the query string, click tools->view profiler, then look at the total time for that line of code. Then I would step to the next line, click tools->show profiler again (that's the only way I could get it to refresh), then subtract the old total from the new total which would tell me how long that query took to run.

That is way too big of a hassle to be worth it. I guess I'll have to code in a custom profiler for the database functions.

Sad
View user's profileFind all posts by cayatesSend private message


Joined: 24 Oct 2006
Posts: 98
Location: Melbourne, AU
Reply with quote
You could wrap your query around a couple of microtime() statements...

$time_start = mircrotime();

your query here

$time_end = microtime();

$how_long = $time_end - $time_start
View user's profileFind all posts by LatsSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I'm not sure if it's helpful, but if you work with mysql you can enable log for long running queries and see them with with their times. With mssql you may run trace utility that is even more helpful. Oracle have functionality similar to mysql.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Profiling feature w/ database queries
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic