@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
- DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network");
if (substr($curl_info['content_type'], 0, 6) == 'image/') {
$text = "[url=" . $match[1] . ']' . $match[1] . "[/url]";
@curl_exec($ch);
$curl_info = @curl_getinfo($ch);
- DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network");
// 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);
- DI::profiler()->saveTimestamp($stamp1, "parser", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "parser");
// Libertree has a problem with escaped hashtags.
$text = str_replace(['\#'], ['#'], $text);
$html = $MarkdownParser->transform($text);
- DI::profiler()->saveTimestamp($stamp1, "parser", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "parser");
return $html;
}
$stamp1 = microtime(true);
$f = file_get_contents("addon/$addon/$addon.php");
- DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file");
$r = preg_match("|/\*.*\*/|msU", $f, $m);
$return = $this->cache->getAllKeys($prefix);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
}
$return = $this->cache->get($key);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
}
$return = $this->cache->set($key, $value, $ttl);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
}
$return = $this->cache->delete($key);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
}
$return = $this->cache->clear($outdated);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
}
$return = $this->cache->add($key, $value, $ttl);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {
$return = $this->cache->compareSet($key, $oldValue, $newValue, $ttl);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {
$return = $this->cache->compareDelete($key, $value);
- $this->profiler->saveTimestamp($time, 'cache', System::callstack());
+ $this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {
throw new InternalServerErrorException($message);
}
- DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "rendering");
return $output;
}
throw new InternalServerErrorException($message);
}
- DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file");
return $template;
}
$stamp1 = microtime(true);
$theme_file = file_get_contents("view/theme/$theme/theme.php");
- DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file");
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);
$this->errorno = $errorno;
}
- $this->profiler->saveTimestamp($stamp1, 'database', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'database');
if ($this->configCache->get('system', 'db_log')) {
$stamp2 = microtime(true);
$this->errorno = $errorno;
}
- $this->profiler->saveTimestamp($stamp, "database_write", System::callstack());
+ $this->profiler->saveTimestamp($stamp, "database_write");
return $retval;
}
}
}
- $this->profiler->saveTimestamp($stamp1, 'database', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'database');
return $columns;
}
break;
}
- $this->profiler->saveTimestamp($stamp1, 'database', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'database');
return $ret;
}
$session = new Session\Native($baseURL, $handler);
}
} finally {
- $profiler->saveTimestamp($stamp1, 'parser', System::callstack());
+ $profiler->saveTimestamp($stamp1, 'parser');
return $session;
}
}
@curl_close($ch);
- $this->profiler->saveTimestamp($stamp1, 'network', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'network');
return $curlResponse;
}
curl_close($ch);
- $this->profiler->saveTimestamp($stamp1, 'network', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'network');
// 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);
- $this->profiler->saveTimestamp($stamp1, "network", System::callstack());
+ $this->profiler->saveTimestamp($stamp1, "network");
if ($http_code == 0) {
return $url;
$body = curl_exec($ch);
curl_close($ch);
- $this->profiler->saveTimestamp($stamp1, "network", System::callstack());
+ $this->profiler->saveTimestamp($stamp1, "network");
if (trim($body) == "") {
return $url;
$stamp1 = microtime(true);
file_put_contents($path, $string);
- DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file");
}
/**
$stamp1 = microtime(true);
file_put_contents($tempfile, $img_str);
- DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "file");
$data = getimagesize($tempfile);
unlink($tempfile);
{
$stamp1 = microtime(true);
$this->logger->emergency($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->alert($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->critical($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->error($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->warning($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->notice($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->info($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->debug($message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
/**
{
$stamp1 = microtime(true);
$this->logger->log($level, $message, $context);
- $this->profiler->saveTimestamp($stamp1, 'file', System::callstack());
+ $this->profiler->saveTimestamp($stamp1, 'file');
}
}
use Friendica\Core\Config\Cache;
use Friendica\Core\Config\IConfig;
+use Friendica\Core\System;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
* Saves a timestamp for a value - f.e. a call
* Necessary for profiling Friendica
*
- * @param int $timestamp the Timestamp
- * @param string $value A value to profile
- * @param string $callstack The callstack of the current profiling data
+ * @param int $timestamp the Timestamp
+ * @param string $value A value to profile
+ * @param string $callstack A callstack string, generated if absent
*/
public function saveTimestamp($timestamp, $value, $callstack = '')
{
return;
}
+ $callstack = $callstack ?: System::callstack(4, 1);
+
$duration = floatval(microtime(true) - $timestamp);
if (!isset($this->performance[$value])) {