@@ -87,8 +87,8 @@ |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | $this->stats[$cat]['count']++; |
| 90 | - $this->stats[$cat]['duration'] += (float)$timing['duration'] * 1000; |
|
| 91 | - $this->stats[$cat]['memory'] += (int)$timing['memoryDiff']; |
|
| 90 | + $this->stats[$cat]['duration'] += (float) $timing['duration'] * 1000; |
|
| 91 | + $this->stats[$cat]['memory'] += (int) $timing['memoryDiff']; |
|
| 92 | 92 | } |
| 93 | 93 | if ($final) { |
| 94 | 94 | $this->export(); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | Event::on( |
| 205 | 205 | Plugins::class, |
| 206 | 206 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 207 | - function (PluginEvent $event) { |
|
| 207 | + function(PluginEvent $event) { |
|
| 208 | 208 | if ($event->plugin === $this) { |
| 209 | 209 | // Invalidate our caches after we've been installed |
| 210 | 210 | $this->clearAllCaches(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | Event::on( |
| 233 | 233 | CraftVariable::class, |
| 234 | 234 | CraftVariable::EVENT_INIT, |
| 235 | - function (Event $event) { |
|
| 235 | + function(Event $event) { |
|
| 236 | 236 | /** @var CraftVariable $variable */ |
| 237 | 237 | $variable = $event->sender; |
| 238 | 238 | $variable->set('webperf', WebperfVariable::class); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | Event::on( |
| 243 | 243 | Plugins::class, |
| 244 | 244 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
| 245 | - function () { |
|
| 245 | + function() { |
|
| 246 | 246 | // Install these only after all other plugins have loaded |
| 247 | 247 | $request = Craft::$app->getRequest(); |
| 248 | 248 | // Only respond to non-console site requests |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | Event::on( |
| 267 | 267 | UrlManager::class, |
| 268 | 268 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 269 | - function (RegisterUrlRulesEvent $event) { |
|
| 269 | + function(RegisterUrlRulesEvent $event) { |
|
| 270 | 270 | Craft::debug( |
| 271 | 271 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 272 | 272 | __METHOD__ |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | Event::on( |
| 290 | 290 | UrlManager::class, |
| 291 | 291 | UrlManager::EVENT_REGISTER_CP_URL_RULES, |
| 292 | - function (RegisterUrlRulesEvent $event) { |
|
| 292 | + function(RegisterUrlRulesEvent $event) { |
|
| 293 | 293 | Craft::debug( |
| 294 | 294 | 'UrlManager::EVENT_REGISTER_CP_URL_RULES', |
| 295 | 295 | __METHOD__ |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | Event::on( |
| 306 | 306 | Dashboard::class, |
| 307 | 307 | Dashboard::EVENT_REGISTER_WIDGET_TYPES, |
| 308 | - function (RegisterComponentTypesEvent $event) { |
|
| 308 | + function(RegisterComponentTypesEvent $event) { |
|
| 309 | 309 | $event->types[] = MetricsWidget::class; |
| 310 | 310 | } |
| 311 | 311 | ); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | Event::on( |
| 314 | 314 | UserPermissions::class, |
| 315 | 315 | UserPermissions::EVENT_REGISTER_PERMISSIONS, |
| 316 | - function (RegisterUserPermissionsEvent $event) { |
|
| 316 | + function(RegisterUserPermissionsEvent $event) { |
|
| 317 | 317 | Craft::debug( |
| 318 | 318 | 'UserPermissions::EVENT_REGISTER_PERMISSIONS', |
| 319 | 319 | __METHOD__ |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | Event::on( |
| 339 | 339 | View::class, |
| 340 | 340 | View::EVENT_END_PAGE, |
| 341 | - function () { |
|
| 341 | + function() { |
|
| 342 | 342 | Craft::debug( |
| 343 | 343 | 'View::EVENT_END_PAGE', |
| 344 | 344 | __METHOD__ |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | Event::on( |
| 363 | 363 | View::class, |
| 364 | 364 | View::EVENT_END_BODY, |
| 365 | - function () { |
|
| 365 | + function() { |
|
| 366 | 366 | Craft::debug( |
| 367 | 367 | 'View::EVENT_END_BODY', |
| 368 | 368 | __METHOD__ |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | Event::on( |
| 386 | 386 | Application::class, |
| 387 | 387 | Application::EVENT_AFTER_REQUEST, |
| 388 | - function () { |
|
| 388 | + function() { |
|
| 389 | 389 | Craft::debug( |
| 390 | 390 | 'Application::EVENT_AFTER_REQUEST', |
| 391 | 391 | __METHOD__ |
@@ -125,16 +125,16 @@ |
||
| 125 | 125 | $sample = new DataSample([ |
| 126 | 126 | 'requestId' => Webperf::$requestUuid, |
| 127 | 127 | 'url' =>DataSample::PLACEHOLDER_URL, |
| 128 | - 'craftTotalMs' => (int)($stats['database']['duration'] |
|
| 128 | + 'craftTotalMs' => (int) ($stats['database']['duration'] |
|
| 129 | 129 | + $stats['twig']['duration'] |
| 130 | 130 | + $stats['other']['duration']), |
| 131 | - 'craftDbMs' => (int)$stats['database']['duration'], |
|
| 132 | - 'craftDbCnt' => (int)$stats['database']['count'], |
|
| 133 | - 'craftTwigMs' => (int)$stats['twig']['duration'], |
|
| 134 | - 'craftTwigCnt' => (int)$stats['twig']['count'], |
|
| 135 | - 'craftOtherMs' => (int)$stats['other']['duration'], |
|
| 136 | - 'craftOtherCnt' => (int)$stats['other']['count'], |
|
| 137 | - 'craftTotalMemory' => (int)($stats['database']['memory'] |
|
| 131 | + 'craftDbMs' => (int) $stats['database']['duration'], |
|
| 132 | + 'craftDbCnt' => (int) $stats['database']['count'], |
|
| 133 | + 'craftTwigMs' => (int) $stats['twig']['duration'], |
|
| 134 | + 'craftTwigCnt' => (int) $stats['twig']['count'], |
|
| 135 | + 'craftOtherMs' => (int) $stats['other']['duration'], |
|
| 136 | + 'craftOtherCnt' => (int) $stats['other']['count'], |
|
| 137 | + 'craftTotalMemory' => (int) ($stats['database']['memory'] |
|
| 138 | 138 | + $stats['twig']['memory'] |
| 139 | 139 | + $stats['other']['memory']), |
| 140 | 140 | ]); |