1 | <?php |
||
29 | class Report implements ReportInterface |
||
30 | { |
||
31 | use MagicPropsTrait { |
||
32 | toArray as traitToArray; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @var Tick |
||
37 | */ |
||
38 | private $tick; |
||
39 | |||
40 | /** |
||
41 | * @var Tracker |
||
42 | */ |
||
43 | private $tracker; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | private $memUsage; |
||
49 | |||
50 | /** |
||
51 | * @var int |
||
52 | */ |
||
53 | private $memPeakUsage; |
||
54 | |||
55 | /** |
||
56 | * @var float |
||
57 | */ |
||
58 | private $itemTime; |
||
59 | |||
60 | /** |
||
61 | * @var float |
||
62 | */ |
||
63 | private $maxTickTime; |
||
64 | |||
65 | /** |
||
66 | * @var float |
||
67 | */ |
||
68 | private $minTickTime; |
||
69 | |||
70 | /** |
||
71 | * Constructor |
||
72 | * |
||
73 | * @param Tick $tick Empty if no tick yet |
||
74 | * @param Tracker $tracker The Task Tracker |
||
75 | */ |
||
76 | public function __construct(Tick $tick, Tracker $tracker) |
||
99 | |||
100 | /** |
||
101 | * Returns the time this task started in microseconds |
||
102 | * |
||
103 | * @return float |
||
104 | */ |
||
105 | public function getTimeStarted() |
||
109 | |||
110 | /** |
||
111 | * Returns the total number of items that are to be processed. |
||
112 | * |
||
113 | * If unknown or not specified, this returns Tracker::UNKNOWN |
||
114 | * |
||
115 | * @return int |
||
116 | */ |
||
117 | public function getTotalItemCount() |
||
121 | |||
122 | /** |
||
123 | * Get the Tracker Tick object for this report |
||
124 | * |
||
125 | * @return Tick |
||
126 | */ |
||
127 | public function getTick() |
||
131 | |||
132 | /** |
||
133 | * Returns the total number of items processed (including skipped and failed) |
||
134 | * |
||
135 | * @return int |
||
136 | */ |
||
137 | public function getNumItemsProcessed() |
||
141 | |||
142 | /** |
||
143 | * Returns the time elapsed in microseconds |
||
144 | * |
||
145 | * @return float |
||
146 | */ |
||
147 | public function getTimeElapsed() |
||
151 | |||
152 | |||
153 | /** |
||
154 | * Returns the number of items thus far that successfully processed |
||
155 | * |
||
156 | * @return int |
||
157 | */ |
||
158 | public function getNumItemsSuccess() |
||
162 | |||
163 | /** |
||
164 | * Returns the number of items processed thus far that failed |
||
165 | * |
||
166 | * @return int |
||
167 | */ |
||
168 | public function getNumItemsFail() |
||
172 | |||
173 | /** |
||
174 | * Returns the number of items processed thus far that were skipped |
||
175 | * |
||
176 | * @return int |
||
177 | */ |
||
178 | public function getNumItemsSkip() |
||
182 | |||
183 | /** |
||
184 | * Returns the amount of time the last item took to process |
||
185 | * |
||
186 | * @return float |
||
187 | */ |
||
188 | public function getItemTime() |
||
192 | |||
193 | /** |
||
194 | * Returns the maximum amount of time any one item has taken to process thus far |
||
195 | * |
||
196 | * @return float |
||
197 | */ |
||
198 | public function getMaxItemTime() |
||
202 | |||
203 | /** |
||
204 | * Returns the minimum amount of time any one item has taken to process thus far |
||
205 | * |
||
206 | * @return float |
||
207 | */ |
||
208 | public function getMinItemTime() |
||
212 | |||
213 | /** |
||
214 | * Returns the current average (mean) amount of time that items have taken to process thus far |
||
215 | * |
||
216 | * @return float |
||
217 | */ |
||
218 | public function getAvgItemTime() |
||
224 | |||
225 | /** |
||
226 | * Returns the message associated with the last Tick event |
||
227 | * |
||
228 | * @return string |
||
229 | */ |
||
230 | public function getMessage() |
||
234 | |||
235 | /** |
||
236 | * Returns the timestamp (microtime float) for this Tick event |
||
237 | * |
||
238 | * @return float |
||
239 | */ |
||
240 | public function getTimestamp() |
||
244 | |||
245 | /** |
||
246 | * Returns the status (Tick::SUCCESS, Tick::FAIL, TICK::SKIP) of the last item processed |
||
247 | * |
||
248 | * @return int |
||
249 | */ |
||
250 | public function getStatus() |
||
254 | |||
255 | /** |
||
256 | * Returns the number of increments associated with the last processed item |
||
257 | * |
||
258 | * @return int |
||
259 | */ |
||
260 | public function getIncrementBy() |
||
264 | |||
265 | /** |
||
266 | * Returns the memory usage at the time of the last processed item (in bytes) |
||
267 | * |
||
268 | * @return int |
||
269 | */ |
||
270 | public function getMemUsage() |
||
274 | |||
275 | /** |
||
276 | * Returns the peak memory usage thus far |
||
277 | * |
||
278 | * @return int |
||
279 | */ |
||
280 | public function getMemPeakUsage() |
||
284 | |||
285 | /** |
||
286 | * Returns this report |
||
287 | * |
||
288 | * @return Report |
||
289 | */ |
||
290 | public function getReport() |
||
294 | |||
295 | /** |
||
296 | * Returns any extra information associated with the last tick |
||
297 | * |
||
298 | * @return array |
||
299 | */ |
||
300 | public function getExtraInfo() |
||
304 | |||
305 | /** |
||
306 | * Converts this report to an array |
||
307 | * |
||
308 | * @return array |
||
309 | */ |
||
310 | public function toArray() |
||
316 | } |
||
317 |