File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -243,4 +243,9 @@ public static function roundVersion(string $version) : string
243243 }
244244 return $ version ;
245245 }
246+
247+ public static function roundSecondsToMilliseconds (float | int $ seconds , int $ precision = 6 ) : float
248+ {
249+ return \round ($ seconds * 1000 , $ precision );
250+ }
246251}
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class_exists('Aplus')
4646 ?>
4747 <p><?= $ count ?> activit<?= $ count === 1
4848 ? 'y was '
49- : 'ies were ' ?> collected in <?= round ($ activities ['total ' ], 6 ) ?> seconds :
49+ : 'ies were ' ?> collected in <?= Debugger:: roundSecondsToMilliseconds ($ activities ['total ' ]) ?> milliseconds :
5050 </p>
5151 <table>
5252 <thead>
@@ -55,7 +55,7 @@ class_exists('Aplus')
5555 <th>Collection</th>
5656 <th>Collector</th>
5757 <th>Description</th>
58- <th title="Seconds ">Runtime</th>
58+ <th title="Milliseconds ">Runtime</th>
5959 <th title="Runtime percentages">
6060 <span>10%</span><span>20%</span><span>30%</span><span>40%</span>
6161 <span>50%</span><span>60%</span><span>70%</span><span>80%</span>
@@ -70,7 +70,7 @@ class_exists('Aplus')
7070 <td><?= htmlentities ($ collected ['collection ' ]) ?> </td>
7171 <td title="<?= htmlentities ($ collected ['class ' ]) ?> "><?= htmlentities ($ collected ['collector ' ]) ?> </td>
7272 <td><?= htmlentities ($ collected ['description ' ]) ?> </td>
73- <td><?= round ($ collected ['total ' ], 6 ) ?> </td>
73+ <td><?= Debugger:: roundSecondsToMilliseconds ($ collected ['total ' ]) ?> </td>
7474 <td>
7575 <span style="width: <?= $ collected ['width ' ] ?> %; margin-left: <?=
7676 $ collected ['left ' ]
Original file line number Diff line number Diff line change @@ -225,4 +225,12 @@ public function testRoundVersion() : void
225225 self ::assertSame ('1.2 ' , Debugger::roundVersion ('1.2.0 ' ));
226226 self ::assertSame ('1 ' , Debugger::roundVersion ('1.0.0 ' ));
227227 }
228+
229+ public function testRoundSecondsToMilliseconds () : void
230+ {
231+ self ::assertSame (1000.0 , Debugger::roundSecondsToMilliseconds (1 ));
232+ self ::assertSame (0.120123 , Debugger::roundSecondsToMilliseconds (0.000120123 ));
233+ self ::assertSame (0.120 , Debugger::roundSecondsToMilliseconds (0.000120 , 3 ));
234+ self ::assertSame (321.998765 , Debugger::roundSecondsToMilliseconds (0.3219987654321 ));
235+ }
228236}
You can’t perform that action at this time.
0 commit comments