File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1212
1313class EloquentPanel implements IBarPanel
1414{
15+ private $ totalTime = 0 ;
16+
1517 private $ queries = [];
1618
1719 public function register (Manager $ connection )
@@ -20,18 +22,15 @@ public function register(Manager $connection)
2022 $ connection ->connection ()->setEventDispatcher (new Dispatcher ());
2123 $ connection ->connection ()->listen (function ($ query ) {
2224 $ this ->queries [] = $ query ;
25+ $ this ->totalTime += $ query ->time ;
2326 });
2427 }
2528
2629 public function getTab ()
2730 {
28- $ count = count ($ this ->queries );
29-
30- if (!$ count ) {
31- return ;
32- }
33-
34- return Helpers::capture (function () use ($ count ) {
31+ return Helpers::capture (function () {
32+ $ count = count ($ this ->queries );
33+ $ totalTime = $ this ->totalTime ;
3534 require __DIR__ .'/templates/tab.phtml ' ;
3635 });
3736 }
Original file line number Diff line number Diff line change 11<span title="Eloquent">
22 <svg viewBox="0 0 2048 2048" style="vertical-align: bottom; width:1.23em; height:1.55em">
3- <path fill="#b079d6" d="M1024 896q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-1152q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-128q0-69 103-128t280-93.5 385-34.5z"/>
3+ <path fill="<?= ( $ count ? ' #b079d6 ' : ' #aaa ' ) ?> " d="M1024 896q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-1152q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-128q0-69 103-128t280-93.5 385-34.5z"/>
44 </svg>
5- <span class="tracy-label" title="Eloquent">Queries ( <?= $ count ?> ) </span>
5+ <span class="tracy-label" title="Eloquent"><?= $ count ?> queries <?= ( $ totalTime ? ' / ' . $ totalTime . ' ms ' : '' ) ?> </span>
66</span>
You can’t perform that action at this time.
0 commit comments