PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/include/adodb/tests/test-perf.php

https://github.com/radicaldesigns/amp
PHP | 50 lines | 36 code | 12 blank | 2 comment | 7 complexity | b95e98b55a0c97573682d39616eafc6d MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. include_once('../adodb-perf.inc.php');
  3. error_reporting(E_ALL);
  4. session_start();
  5. if (isset($_GET)) {
  6. foreach($_GET as $k => $v) {
  7. if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k;
  8. }
  9. }
  10. if (isset($_SESSION['_db'])) {
  11. $_db = $_SESSION['_db'];
  12. $_GET[$_db] = 1;
  13. $$_db = 1;
  14. }
  15. echo "<h1>Performance Monitoring</h1>";
  16. include_once('testdatabases.inc.php');
  17. function testdb($db)
  18. {
  19. if (!$db) return;
  20. echo "<font size=1>";print_r($db->ServerInfo()); echo " user=".$db->user."</font>";
  21. $perf = NewPerfMonitor($db);
  22. # unit tests
  23. if (0) {
  24. //$DB->debug=1;
  25. echo "Data Cache Size=".$perf->DBParameter('data cache size').'<p>';
  26. echo $perf->HealthCheck();
  27. echo($perf->SuspiciousSQL());
  28. echo($perf->ExpensiveSQL());
  29. echo($perf->InvalidSQL());
  30. echo $perf->Tables();
  31. echo "<pre>";
  32. echo $perf->HealthCheckCLI();
  33. $perf->Poll(3);
  34. die();
  35. }
  36. if ($perf) $perf->UI(3);
  37. }
  38. ?>