I am using this php class. here it is https://github.com/joshcam/PHP-MySQLi-Database-Class
Could someone tell me how I can get the number of queries that have been run during a trace session. The trace documentation is at the end of the documentation page on github.
According to this documentation, each trace is stored in the object as an array see print_r ($db->trace);
at the end.
Query exectution time benchmarking
To track query execution time setTrace() function should be called.
$db->setTrace (true);
// As a second parameter it is possible to define prefix of the path which should be striped from filename
// $db->setTrace (true, $_SERVER['SERVER_ROOT']);
$db->get("users");
$db->get("test");
print_r ($db->trace);
[0] => Array
(
[0] => SELECT * FROM t_users ORDER BY `id` ASC
[1] => 0.0010669231414795
[2] => MysqliDb->get() >> file "/avb/work/PHP-MySQLi-Database-Class/tests.php" line #151
)
[1] => Array
(
[0] => SELECT * FROM t_test
[1] => 0.00069189071655273
[2] => MysqliDb->get() >> file "/avb/work/PHP-MySQLi-Database-Class/tests.php" line #152
)
So you can get the number of queries executed by just doing
$num = count($db->trace);