Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username'], 'duration' => round($duration, 2)]);
- $a->getProfiler()->saveLog(DI::logger(), API_LOG_PREFIX . 'performance');
+ DI::profiler()->saveLog(DI::logger(), API_LOG_PREFIX . 'performance');
if (false === $return) {
/*
return $this->config->getCache()->get('system', 'basepath');
}
- /**
- * The profiler of this app
- *
- * @return Profiler
- */
- public function getProfiler()
- {
- return $this->profiler;
- }
-
/**
* Returns the Mode of the Application
*
@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
if (substr($curl_info['content_type'], 0, 6) == 'image/') {
$text = "[url=" . $match[1] . ']' . $match[1] . "[/url]";
@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
// if its a link to a picture then embed this picture
if (substr($curl_info['content_type'], 0, 6) == 'image/') {
// Now convert HTML to Markdown
$text = HTML::toMarkdown($text);
- $a->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "parser", System::callstack());
// Libertree has a problem with escaped hashtags.
$text = str_replace(['\#'], ['#'], $text);
$html = $MarkdownParser->transform($text);
- DI::app()->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "parser", System::callstack());
return $html;
}
$stamp1 = microtime(true);
$f = file_get_contents("addon/$addon/$addon.php");
- $a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
$r = preg_match("|/\*.*\*/|msU", $f, $m);
exit();
}
- $a->getProfiler()->saveTimestamp($stamp1, "rendering", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
return $output;
}
exit();
}
- $a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
return $template;
}
return $info;
}
- $a = \get_app();
$stamp1 = microtime(true);
$theme_file = file_get_contents("view/theme/$theme/theme.php");
- $a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);
// We use the callstack here to analyze the performance of executed worker entries.
// For this reason the variables have to be initialized.
- $a->getProfiler()->reset();
+ DI::profiler()->reset();
$a->queue = $queue;
Logger::info('Process done.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'duration' => round($duration, 3)]);
- $a->getProfiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
+ DI::profiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
$cooldown = Config::get("system", "worker_cooldown", 0);
use Friendica\Util\DateTimeFormat;
use Friendica\Util\FileSystem;
use Friendica\Util\Logger\WorkerLogger;
+use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
* @method static LoggerInterface logger()
* @method static LoggerInterface devLogger()
* @method static LoggerInterface workerLogger()
+ * @method static Profiler profiler()
* @method static ISession session()
* @method static App\Authentication auth()
* @method static App\Arguments args()
'session' => ISession::class,
'dba' => Database::class,
'fs' => FileSystem::class,
+ 'profiler' => Profiler::class,
];
/** @var Dice */
use Exception;
use Friendica\Core\Config;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Util\Images;
use Imagick;
use ImagickPixel;
$string = $this->asString();
- $a = \get_app();
-
$stamp1 = microtime(true);
file_put_contents($path, $string);
- $a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
}
/**
$stamp1 = microtime(true);
file_put_contents($tempfile, $img_str);
- DI::app()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
$data = getimagesize($tempfile);
unlink($tempfile);
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Network\CurlResult;
class Network
@curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, 'network', System::callstack());
return $curlResponse;
}
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, 'network', System::callstack());
// Very old versions of Lighttpd don't like the "Expect" header, so we remove it when needed
if ($curlResponse->getReturnCode() == 417) {
$http_code = $curl_info['http_code'];
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
if ($http_code == 0) {
return $url;
$body = curl_exec($ch);
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
if (trim($body) == "") {
return $url;