You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
690 B

  1. <?php
  2. /**
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage util
  7. * @since 2010-03-09
  8. * @version SVN: $Id$
  9. * @filesource $URL$
  10. */
  11. class QueryProfiler
  12. {
  13. protected $query = '';
  14. protected $start = null;
  15. protected $end = null;
  16. public function __construct($query)
  17. {
  18. $this->query = $query;
  19. $this->start = microtime(true);
  20. }
  21. public function end()
  22. {
  23. $this->end = microtime(true);
  24. }
  25. public function getQuery()
  26. {
  27. return $this->query;
  28. }
  29. public function getElapsed()
  30. {
  31. return $this->end - $this->start;
  32. }
  33. }