+
+ if (isset($this->callstack["rendering"])) {
+ $output .= "\nRendering:\n";
+ foreach ($this->callstack["rendering"] as $func => $time) {
+ $time = round($time, 3);
+ if ($time > $limit) {
+ $output .= $func . ": " . $time . "\n";
+ }
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Save the current profiling data to a log entry
+ *
+ * @param LoggerInterface $logger The logger to save the current log
+ * @param string $message Additional message for the log
+ */
+ public function saveLog(LoggerInterface $logger, $message = '')
+ {
+ $duration = microtime(true) - $this->get('start');
+ $logger->info(
+ $message,
+ [
+ 'action' => 'profiling',
+ 'database_read' => round($this->get('database') - $this->get('database_write'), 3),
+ 'database_write' => round($this->get('database_write'), 3),
+ 'cache_read' => round($this->get('cache'), 3),
+ 'cache_write' => round($this->get('cache_write'), 3),
+ 'network_io' => round($this->get('network'), 2),
+ 'file_io' => round($this->get('file'), 2),
+ 'other_io' => round($duration - ($this->get('database')
+ + $this->get('cache') + $this->get('cache_write')
+ + $this->get('network') + $this->get('file')), 2),
+ 'total' => round($duration, 2)
+ ]
+ );
+
+ if ($this->isRendertime()) {
+ $output = $this->getRendertimeString();
+ $logger->info($message . ": " . $output, ['action' => 'profiling']);
+ }