File tree Expand file tree Collapse file tree 3 files changed +52
-2
lines changed
src/Symfony/Component/Stopwatch Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Original file line number Diff line number Diff line change 10
10
` MongoDate ` instead of ` MongoTimestamp ` , which also makes it possible to use
11
11
TTL collections in MongoDB 2.2+ instead of relying on the ` gc() ` method.
12
12
13
+ * The Stopwatch functionality was moved from HttpKernel\Debug to its own component
14
+
13
15
#### Deprecations
14
16
15
17
* The ` Request::splitHttpAcceptHeader() ` is deprecated and will be removed in 2.3.
Original file line number Diff line number Diff line change 18
18
*/
19
19
class Stopwatch
20
20
{
21
+ /**
22
+ * @var Section[]
23
+ */
21
24
private $ sections ;
25
+
26
+ /**
27
+ * @var array
28
+ */
22
29
private $ activeSections ;
23
30
24
31
public function __construct ()
@@ -54,6 +61,8 @@ public function openSection($id = null)
54
61
* @see getSectionEvents
55
62
*
56
63
* @param string $id The identifier of the section
64
+ *
65
+ * @throws \LogicException When there's no started section to be stopped
57
66
*/
58
67
public function stopSection ($ id )
59
68
{
@@ -117,11 +126,32 @@ public function getSectionEvents($id)
117
126
}
118
127
}
119
128
129
+
130
+ /**
131
+ * @internal This class is for internal usage only
132
+ *
133
+ * @author Fabien Potencier <fabien@symfony.com>
134
+ */
120
135
class Section
121
136
{
137
+ /**
138
+ * @var StopwatchEvent[]
139
+ */
122
140
private $ events = array ();
141
+
142
+ /**
143
+ * @var null|float
144
+ */
123
145
private $ origin ;
146
+
147
+ /**
148
+ * @var string
149
+ */
124
150
private $ id ;
151
+
152
+ /**
153
+ * @var Section[]
154
+ */
125
155
private $ children = array ();
126
156
127
157
/**
@@ -236,7 +266,7 @@ public function stopEvent($name)
236
266
*/
237
267
public function lap ($ name )
238
268
{
239
- return $ this ->stop ($ name )->start ();
269
+ return $ this ->stopEvent ($ name )->start ();
240
270
}
241
271
242
272
/**
@@ -249,3 +279,4 @@ public function getEvents()
249
279
return $ this ->events ;
250
280
}
251
281
}
282
+
Original file line number Diff line number Diff line change 18
18
*/
19
19
class StopwatchEvent
20
20
{
21
+ /**
22
+ * @var StopwatchPeriod[]
23
+ */
21
24
private $ periods ;
25
+
26
+ /**
27
+ * @var float
28
+ */
22
29
private $ origin ;
30
+
31
+ /**
32
+ * @var string
33
+ */
23
34
private $ category ;
35
+
36
+ /**
37
+ * @var float[]
38
+ */
24
39
private $ started ;
25
40
26
41
/**
@@ -74,6 +89,8 @@ public function start()
74
89
/**
75
90
* Stops the last started event period.
76
91
*
92
+ * @throws \LogicException When start wasn't called before stopping
93
+ *
77
94
* @return StopwatchEvent The event
78
95
*/
79
96
public function stop ()
@@ -182,7 +199,7 @@ protected function getNow()
182
199
/**
183
200
* Formats a time.
184
201
*
185
- * @param numerical $time A raw time
202
+ * @param integer|float $time A raw time
186
203
*
187
204
* @return float The formatted time
188
205
*
You can’t perform that action at this time.
0 commit comments