Howto: DB Profile (qcodo-0.3.2.1)

thread: 4 messages  |  last: about 3 years ago  |  started: friday, april 27, 2007, 1:42 pm pdt


#1  |  w. Patrick Gale (Chapel Hill, NC) United States of America
Friday, April 27, 2007, 1:42 PM PDT

Debugging your pages and want to see the list of database queries executed on all of your qcodo outputted pages?  Follow these steps

1. Enable DB profiling by either:
A. Checking your configuration.inc.php script and making sure to set the profiling flag in your database connection to true, or
B. Edit '/includes/header.inc.php' and add...

// start profiling/logging the database queries
// replace '1' in the following line with the database connection you are using
QApplication::$Database[1]->EnableProfiling();

...at the top of the script

2. Edit '/includes/footer.inc.php' and add...

// print link to view database queries
// again, replace '1' with whatever database connection you are using
QApplication::$Database[1]->OutputProfiling();

...at the end of your script (after all database calls have been made)

When you refresh your application you should see a line at the bottom of the pages, similar to the following:
PROFILING INFORMATION FOR DATABASE CONNECTION #1: 32 queries performed. Please click here to view profiling detail

The script that outputs the profile information is '/assets/php/_core/profile.php'.


cheers - wpg

#2  |  syntaxtimawa (Davao City, Philippines) Philippines
Wednesday, February 6, 2008, 1:21 AM PST

I've been looking and searching for discussion regarding db profiling yet I didn't find any that would have to display only the following:

1. total number of queries done by that page.
2. total amount of time taken by the query to finish CRUDing the data.

i understand that what i need to retrieve is:
 round(count($this->strProfileArray) / 2) from QDatabaseBase.class.php

and i hope there's a way to determine the total amount of time taken to finish all queries and each of the query.

I don't know if this is necessary but I think it'll be useful somehow.

Thanks.

#3  |  VexedPanda (Calgary, AB) Canada
Thursday, February 14, 2008, 8:58 AM PST

For performance profiling, you're much better using something like X-Debug's profiling <http://xdebug.org/docs/profiler> and WinCacheGrind to analyze the logs.

#4  |  alex94040 (Seattle, WA) United States of America Qcodo Core Contributor
Tuesday, November 11, 2008, 10:44 AM PST

I would discourage using XDebug in the production environment, exactly for performance reasons. You can profile your test server, but don't put XDebug on the production box - it will slow things down considerably.

There are lighter-weight packages (one of them I'm working on right now) that allow you to just capture how long each page took to execute. You can write that info into the database on the production server, and then look into profiling that page using XDebug / query logging on your test / dev box.



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.