Support for stacked profiler analysis

This commit is contained in:
Michael 2021-07-27 04:57:29 +00:00
parent 3cef3ab107
commit c89533a70b
17 changed files with 763 additions and 611 deletions

View file

@ -21,7 +21,6 @@
namespace Friendica\Content\Text;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
@ -40,7 +39,7 @@ class Markdown
* @return string
*/
public static function convert($text, $hardwrap = true, $baseuri = null) {
$stamp1 = microtime(true);
DI::profiler()->startRecording('rendering');
$MarkdownParser = new MarkdownParser();
$MarkdownParser->code_class_prefix = 'language-';
@ -57,7 +56,7 @@ class Markdown
$html = $MarkdownParser->transform($text);
DI::profiler()->saveTimestamp($stamp1, "parser");
DI::profiler()->stopRecording();
return $html;
}
@ -109,6 +108,8 @@ class Markdown
*/
public static function toBBCode($s)
{
DI::profiler()->startRecording('rendering');
// The parser cannot handle paragraphs correctly
$s = str_replace(['</p>', '<p>', '<p dir="ltr">'], ['<br>', '<br>', '<br>'], $s);
@ -134,6 +135,7 @@ class Markdown
// Don't show link to full picture (until it is fixed)
$s = BBCode::scaleExternalImages($s);
DI::profiler()->stopRecording();
return $s;
}
}