Documentation

Class Phalcon\Profiler

implements Phalcon\ProfilerInterface

Source on GitHub

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\Profiler();

//Set the connection profiler
$connection->setProfiler($profiler);

//Get the last profile in the profiler
$profile = $profiler->stopProfile();

echo "Data: ", $profile->getData(), "\n";
echo "Start Time: ", $profile->getInitialTime(), "\n";
echo "Final Time: ", $profile->getFinalTime(), "\n";
echo "Total Elapsed Time: ", $profile->getTotalElapsedSeconds(), "\n";

Methods

public __construct ([unknown $unique])

Constructor for Phalcon\Profiler\Item

public Phalcon\Profiler\ItemInterface startProfile (string $name, [array $data])

Starts the profile

public Phalcon\Profiler stopProfile ([unknown $name])

Stops the active profile

public double getTotalElapsedSeconds ()

Returns the total time in seconds spent by the profiles

public int getTotalUsageMemory ()

Returns the total time in seconds spent by the profiles

public Phalcon\Profiler\Item [] getProfiles ()

Returns all the processed profiles

public Phalcon\Profiler\Item getLastProfile ()

Returns the last profile executed in the profiler

public Phalcon\Profiler\Item getCurrentProfile ()

Returns the current profile executed in the profiler

public Phalcon\Profiler reset ()

Resets the profiler, cleaning up all the profiles