Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • Section
  • Stopwatch
  • StopwatchEvent
  • StopwatchPeriod
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <fabien@symfony.com>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\Stopwatch;
13: 
14: /**
15:  * Represents an Period for an Event.
16:  *
17:  * @author Fabien Potencier <fabien@symfony.com>
18:  */
19: class StopwatchPeriod
20: {
21:     private $start;
22:     private $end;
23:     private $memory;
24: 
25:     /**
26:      * Constructor
27:      *
28:      * @param integer $start The relative time of the start of the period
29:      * @param integer $end   The relative time of the end of the period
30:      */
31:     public function __construct($start, $end)
32:     {
33:         $this->start = (integer) $start;
34:         $this->end = (integer) $end;
35:         $this->memory = memory_get_usage(true);
36:     }
37: 
38:     /**
39:      * Gets the relative time of the start of the period.
40:      *
41:      * @return integer The time (in milliseconds)
42:      */
43:     public function getStartTime()
44:     {
45:         return $this->start;
46:     }
47: 
48:     /**
49:      * Gets the relative time of the end of the period.
50:      *
51:      * @return integer The time (in milliseconds)
52:      */
53:     public function getEndTime()
54:     {
55:         return $this->end;
56:     }
57: 
58:     /**
59:      * Gets the time spent in this period.
60:      *
61:      * @return integer The period duration (in milliseconds)
62:      */
63:     public function getDuration()
64:     {
65:         return $this->end - $this->start;
66:     }
67: 
68:     /**
69:      * Gets the memory usage.
70:      *
71:      * @return integer The memory usage (in bytes)
72:      */
73:     public function getMemory()
74:     {
75:         return $this->memory;
76:     }
77: }
78: 
php-coveralls API documentation generated by ApiGen 2.8.0