Development

/branches/1.4/lib/debug/sfTimerManager.class.php

You must first sign up to be able to contribute.

root/branches/1.4/lib/debug/sfTimerManager.class.php

Revision 33570, 1.3 kB (checked in by fabien, 2 years ago)

[1.4] fixed Doctrine queries execution time in the profiler (closes #10079, patch from jakub.turek)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfTimerManager is a container for sfTimer objects.
13  *
14  * @package    symfony
15  * @subpackage util
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfTimerManager
20 {
21   static public $timers = array();
22
23   /**
24    * Gets a sfTimer instance.
25    *
26    * It returns the timer named $name or create a new one if it does not exist.
27    *
28    * @param string $name The name of the timer
29    *
30    * @return sfTimer The timer instance
31    */
32   public static function getTimer($name,$reset=true)
33   {
34     if (!isset(self::$timers[$name]))
35     {
36       self::$timers[$name] = new sfTimer($name);
37     }
38
39     if($reset){
40        self::$timers[$name]->startTimer();
41     }
42
43     return self::$timers[$name];
44   }
45
46   /**
47    * Gets all sfTimer instances stored in sfTimerManager.
48    *
49    * @return array An array of all sfTimer instances
50    */
51   public static function getTimers()
52   {
53     return self::$timers;
54   }
55
56   /**
57    * Clears all sfTimer instances stored in sfTimerManager.
58    */
59   public static function clearTimers()
60   {
61     self::$timers = array();
62   }
63 }
64
Note: See TracBrowser for help on using the browser.