diff options
author | Arun Persaud <arun@nubati.net> | 2009-03-29 11:13:59 -0700 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2009-03-29 11:13:59 -0700 |
commit | 4209593d06a237995d8cc0ba527188a15cbd0376 (patch) | |
tree | f1c1d01bf5634f4595bd004446778f84b007c629 | |
parent | e3b15417c99b27677a56eae5d26779f90b48adf8 (diff) | |
download | e-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.tar.gz e-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.tar.bz2 e-DoKo-4209593d06a237995d8cc0ba527188a15cbd0376.zip |
CLEANUP: better debugging option for DB querries
add option to only log querries that take a long time
-rw-r--r-- | include/db.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/db.php b/include/db.php index da005a1..e389db4 100644 --- a/include/db.php +++ b/include/db.php @@ -59,16 +59,17 @@ function DB_test() function DB_query($query) { /* debug/optimize the database - $logfile=fopen('/tmp/DBlog.log','a+'); - fwrite($logfile,"EXPLAIN $query ;\n"); - $time = microtime(); $return = mysql_query($query); $time = $time - microtime(); - fwrite($logfile,"time of above query: $time\n"); - - fclose($logfile); + if($time > 0.05) // this way we can find only the long ones + { + $logfile=fopen('/tmp/DBlog.log','a+'); + fwrite($logfile,"EXPLAIN $query ;\n"); + fwrite($logfile,"time of above query: $time\n"); + fclose($logfile); + }; return $return; */ |