extends class Phalcon\Profiler
implements Phalcon\ProfilerInterface
Instances of Phalcon\Db can generate execution profiles on SQL statements sent to the relational database. Profiled information includes execution time in miliseconds. This helps you to identify bottlenecks in your applications.
<?php
$profiler = new Phalcon\Db\Profiler();
//Set the connection profiler
$connection->setProfiler($profiler);
$sql = "SELECT buyer_name, quantity, product_name
FROM buyers LEFT JOIN products ON
buyers.pid=products.id";
//Execute a SQL statement
$connection->query($sql);
//Get the last profile in the profiler
$profile = $profiler->getLastProfile();
echo "SQL Statement: ", $profile->getSQLStatement(), "\n";
echo "Start Time: ", $profile->getInitialTime(), "\n";
echo "Final Time: ", $profile->getFinalTime(), "\n";
echo "Total Elapsed Time: ", $profile->getTotalElapsedSeconds(), "\n";
public Phalcon\Db\Profiler\Item startProfile (string $name, [array $data])
Starts the profile of a SQL sentence
public integer getNumberTotalStatements ()
Returns the total number of SQL statements processed
public __construct ([unknown $unique]) inherited from Phalcon\Profiler
Constructor for Phalcon\Profiler\Item
public Phalcon\Profiler stopProfile ([unknown $name]) inherited from Phalcon\Profiler
Stops the active profile
public double getTotalElapsedSeconds () inherited from Phalcon\Profiler
Returns the total time in seconds spent by the profiles
public int getTotalUsageMemory () inherited from Phalcon\Profiler
Returns the total time in seconds spent by the profiles
public Phalcon\Profiler\Item [] getProfiles () inherited from Phalcon\Profiler
Returns all the processed profiles
public Phalcon\Profiler\Item getLastProfile () inherited from Phalcon\Profiler
Returns the last profile executed in the profiler
public Phalcon\Profiler\Item getCurrentProfile () inherited from Phalcon\Profiler
Returns the current profile executed in the profiler
public Phalcon\Profiler reset () inherited from Phalcon\Profiler
Resets the profiler, cleaning up all the profiles