$this->performance["database"] = 0;
$this->performance["network"] = 0;
$this->performance["rendering"] = 0;
+ $this->performance["parser"] = 0;
$this->config = array();
$this->page = array();
return $this->rdelim[$engine];
}
+ function save_timestamp($stamp1, $value) {
+ $stamp2 = microtime(true);
+ $duration = (float)($stamp2-$stamp1);
+ $this->performance[$value] += (float)$duration;
+ }
+
}
}
function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
+ $stamp1 = microtime(true);
+
$a = get_app();
// Hide all [noparse] contained bbtags by spacefying them
call_hooks('bbcode',$Text);
+ $a->save_timestamp($stamp1, "parser");
+
return $Text;
}
public $error = false;
function __construct($server,$user,$pass,$db,$install = false) {
+ global $a;
+
+ $stamp1 = microtime(true);
$server = trim($server);
$user = trim($user);
if(! $install)
system_unavailable();
}
+
+ $a->save_timestamp($stamp1, "network");
}
public function getdb() {
$stamp2 = microtime(true);
$duration = (float)($stamp2-$stamp1);
- $a->performance["database"] += (float)$duration;
if(x($a->config,'system') && x($a->config['system'],'db_log')) {
if (($duration > $a->config["system"]["db_loglimit"])) {
}
}
+ $a->save_timestamp($stamp1, "database");
if($this->debug)
logger('dba: ' . printable(print_r($r, true)));
if (($cachefile != '') AND !file_exists($cachefile)) {
$s = prepare_text($arr['body']);
+ $stamp1 = microtime(true);
file_put_contents($cachefile, $s);
+ $a->save_timestamp($stamp1, "file");
logger('item_store: put item '.$current_post.' into cachefile '.$cachefile);
}
$a->set_curl_headers($header);
@curl_close($ch);
- $stamp2 = microtime(true);
- $duration = (float)($stamp2-$stamp1);
- $a->performance["network"] += (float)$duration;
+ $a->save_timestamp($stamp1, "network");
return($body);
}}
curl_close($ch);
- $stamp2 = microtime(true);
- $duration = (float)($stamp2-$stamp1);
- $a->performance["network"] += (float)$duration;
+ $a->save_timestamp($stamp1, "network");
return($body);
}}
$i = fetch_url($scaled);
$cachefile = get_cachefile(hash("md5", $scaled));
- if ($cachefile != '')
+ if ($cachefile != '') {
+ $stamp1 = microtime(true);
file_put_contents($cachefile, $i);
+ $a->save_timestamp($stamp1, "file");
+ }
// guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true);
'author' => array(),
'version' => ""
);
-
+
if (!is_file("addon/$plugin/$plugin.php")) return $info;
-
+
+ $stamp1 = microtime(true);
$f = file_get_contents("addon/$plugin/$plugin.php");
+ $a->save_timestamp($stamp1, "file");
+
$r = preg_match("|/\*.*\*/|msU", $f, $m);
-
+
if ($r){
$ll = explode("\n", $m[0]);
foreach( $ll as $l ) {
$info['unsupported'] = true;
if (!is_file("view/theme/$theme/theme.php")) return $info;
-
+
+ $stamp1 = microtime(true);
$f = file_get_contents("view/theme/$theme/theme.php");
+ $a->save_timestamp($stamp1, "file");
+
$r = preg_match("|/\*.*\*/|msU", $f, $m);
-
-
+
if ($r){
$ll = explode("\n", $m[0]);
foreach( $ll as $l ) {
if (($cachefile != '') AND !file_exists($cachefile)) {
$s = prepare_text($message['body']);
+ $stamp1 = microtime(true);
file_put_contents($cachefile, $s);
+ $a->save_timestamp($stamp1, "file");
logger('create_tags_from_item: put item '.$message["id"].' into cachefile '.$cachefile);
}
$lang = 'en';
$b = basename($s);
$d = dirname($s);
- if(file_exists("$d/$lang/$b"))
- return file_get_contents("$d/$lang/$b");
+ if(file_exists("$d/$lang/$b")) {
+ $stamp1 = microtime(true);
+ $content = file_get_contents("$d/$lang/$b");
+ $a->save_timestamp($stamp1, "file");
+ return $content;
+ }
$theme = current_theme();
- if(file_exists("$d/theme/$theme/$b"))
- return file_get_contents("$d/theme/$theme/$b");
+ if(file_exists("$d/theme/$theme/$b")) {
+ $stamp1 = microtime(true);
+ $content = file_get_contents("$d/theme/$theme/$b");
+ $a->save_timestamp($stamp1, "file");
+ return $content;
+ }
- return file_get_contents($s);
+ $stamp1 = microtime(true);
+ $content = file_get_contents($s);
+ $a->save_timestamp($stamp1, "file");
+ return $content;
}}
if(! function_exists('get_intltext_template')) {
if(! isset($lang))
$lang = 'en';
- if(file_exists("view/$lang$engine/$s"))
- return file_get_contents("view/$lang$engine/$s");
- elseif(file_exists("view/en$engine/$s"))
- return file_get_contents("view/en$engine/$s");
- else
- return file_get_contents("view$engine/$s");
+ if(file_exists("view/$lang$engine/$s")) {
+ $stamp1 = microtime(true);
+ $content = file_get_contents("view/$lang$engine/$s");
+ $a->save_timestamp($stamp1, "file");
+ return $content;
+ } elseif(file_exists("view/en$engine/$s")) {
+ $stamp1 = microtime(true);
+ $content = file_get_contents("view/en$engine/$s");
+ $a->save_timestamp($stamp1, "file");
+ return $content;
+ } else {
+ $stamp1 = microtime(true);
+ $content = file_get_contents("view$engine/$s");
+ $a->save_timestamp($stamp1, "file");
+ return $content;
+ }
}}
if(! function_exists('get_markup_template')) {
$template = new FriendicaSmarty();
$template->filename = $template_file;
-
- $stamp2 = microtime(true);
- $duration = (float)($stamp2-$stamp1);
- $a->performance["rendering"] += (float)$duration;
+ $a->save_timestamp($stamp1, "rendering");
return $template;
}
else {
$template_file = get_template_file($a, $s, $root);
+ $a->save_timestamp($stamp1, "rendering");
- $stamp2 = microtime(true);
- $duration = (float)($stamp2-$stamp1);
- $a->performance["rendering"] += (float)$duration;
+ $stamp1 = microtime(true);
+ $content = file_get_contents($template_file);
+ $a->save_timestamp($stamp1, "file");
+ return $content;
- return file_get_contents($template_file);
}
}}
if((! $debugging) || (! $logfile) || ($level > $loglevel))
return;
-
+
+ $stamp1 = microtime(true);
@file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $msg . "\n", FILE_APPEND);
+ $a->save_timestamp($stamp1, "file");
return;
}}
$cachefile = get_cachefile($item["guid"]."-".hash("md5", $item['body']));
if (($cachefile != '')) {
- if (file_exists($cachefile))
+ if (file_exists($cachefile)) {
+ $stamp1 = microtime(true);
$s = file_get_contents($cachefile);
- else {
+ $a->save_timestamp($stamp1, "file");
+ } else {
$s = prepare_text($item['body']);
+ $stamp1 = microtime(true);
file_put_contents($cachefile, $s);
+ $a->save_timestamp($stamp1, "file");
logger('prepare_body: put item '.$item["id"].' into cachefile '.$cachefile);
}
} else
if (($cachefile != '') AND !file_exists($cachefile)) {
$s = prepare_text($datarray['body']);
+ $stamp1 = microtime(true);
file_put_contents($cachefile, $s);
+ $a->save_timestamp($stamp1, "file");
logger('mod_item: put item '.$r[0]['id'].' into cachefile '.$cachefile);
}