Bugfixing after adding timestamps

This commit is contained in:
Michael Vogel 2013-01-27 13:57:44 +01:00
parent fdee002f73
commit 2cb576d305
8 changed files with 72 additions and 65 deletions

View file

@ -418,6 +418,8 @@ if(! class_exists('App')) {
$this->performance["network"] = 0; $this->performance["network"] = 0;
$this->performance["rendering"] = 0; $this->performance["rendering"] = 0;
$this->performance["parser"] = 0; $this->performance["parser"] = 0;
$this->performance["marktime"] = 0;
$this->performance["markstart"] = microtime(true);
$this->config = array(); $this->config = array();
$this->page = array(); $this->page = array();
@ -726,12 +728,17 @@ if(! class_exists('App')) {
return $this->rdelim[$engine]; return $this->rdelim[$engine];
} }
function save_timestamp($stamp1, $value) { function save_timestamp($stamp, $value) {
$stamp2 = microtime(true); $duration = (float)(microtime(true)-$stamp);
$duration = (float)($stamp2-$stamp1);
$this->performance[$value] += (float)$duration; $this->performance[$value] += (float)$duration;
$this->performance["marktime"] += (float)$duration;
} }
function mark_timestamp($mark) {
//$this->performance["markstart"] -= microtime(true) - $this->performance["marktime"];
$this->performance["markstart"] = microtime(true) - $this->performance["markstart"] - $this->performance["marktime"];
}
} }
} }

View file

@ -368,7 +368,6 @@ function visible_activity($item) {
if(!function_exists('conversation')) { if(!function_exists('conversation')) {
function conversation(&$a, $items, $mode, $update, $preview = false) { function conversation(&$a, $items, $mode, $update, $preview = false) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
$ssl_state = ((local_user()) ? true : false); $ssl_state = ((local_user()) ? true : false);

View file

@ -195,6 +195,9 @@ function call_hooks($name, &$data = null) {
if (! function_exists('get_plugin_info')){ if (! function_exists('get_plugin_info')){
function get_plugin_info($plugin){ function get_plugin_info($plugin){
$a = get_app();
$info=Array( $info=Array(
'name' => $plugin, 'name' => $plugin,
'description' => "", 'description' => "",
@ -270,6 +273,7 @@ function get_theme_info($theme){
if (!is_file("view/theme/$theme/theme.php")) return $info; if (!is_file("view/theme/$theme/theme.php")) return $info;
$a = get_app();
$stamp1 = microtime(true); $stamp1 = microtime(true);
$f = file_get_contents("view/theme/$theme/theme.php"); $f = file_get_contents("view/theme/$theme/theme.php");
$a->save_timestamp($stamp1, "file"); $a->save_timestamp($stamp1, "file");

View file

@ -39,9 +39,7 @@ function replace_macros($s,$r) {
$output = template_unescape($r); $output = template_unescape($r);
} }
$a = get_app(); $a = get_app();
$stamp2 = microtime(true); $a->save_timestamp($stamp1, "rendering");
$duration = (float)($stamp2-$stamp1);
$a->performance["rendering"] += (float)$duration;
return $output; return $output;
}} }}

View file

@ -130,7 +130,6 @@ function admin_content(&$a) {
* Page content * Page content
*/ */
$o = ''; $o = '';
// urls // urls
if ($a->argc > 1){ if ($a->argc > 1){
switch ($a->argv[1]){ switch ($a->argv[1]){
@ -775,7 +774,7 @@ function admin_page_plugins(&$a){
} }
if (x($_GET,"a") && $_GET['a']=="t"){ if (x($_GET,"a") && $_GET['a']=="t"){
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't'); check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
// Toggle plugin status // Toggle plugin status
$idx = array_search($plugin, $a->plugins); $idx = array_search($plugin, $a->plugins);
@ -817,6 +816,7 @@ function admin_page_plugins(&$a){
} }
$t = get_markup_template("admin_plugins_details.tpl"); $t = get_markup_template("admin_plugins_details.tpl");
return replace_macros($t, array( return replace_macros($t, array(
'$title' => t('Administration'), '$title' => t('Administration'),
'$page' => t('Plugins'), '$page' => t('Plugins'),
@ -836,7 +836,7 @@ function admin_page_plugins(&$a){
'$screenshot' => '', '$screenshot' => '',
'$readme' => $readme, '$readme' => $readme,
'$form_security_token' => get_form_security_token("admin_themes"), '$form_security_token' => get_form_security_token("admin_themes"),
)); ));
} }
@ -974,7 +974,7 @@ function admin_page_themes(&$a){
} }
if (x($_GET,"a") && $_GET['a']=="t"){ if (x($_GET,"a") && $_GET['a']=="t"){
check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't'); check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't');
// Toggle theme status // Toggle theme status
@ -1016,7 +1016,6 @@ function admin_page_themes(&$a){
} }
$screenshot = array( get_theme_screenshot($theme), t('Screenshot')); $screenshot = array( get_theme_screenshot($theme), t('Screenshot'));
if(! stristr($screenshot[0],$theme)) if(! stristr($screenshot[0],$theme))
$screenshot = null; $screenshot = null;
@ -1044,8 +1043,6 @@ function admin_page_themes(&$a){
)); ));
} }
/** /**
* List themes * List themes
*/ */

View file

@ -571,7 +571,7 @@ function network_content(&$a, $update = 0) {
} }
// We don't have to deal with ACL's on this page. You're looking at everything // We don't have to deal with ACLs on this page. You're looking at everything
// that belongs to you, hence you can see all of it. We will filter by group if // that belongs to you, hence you can see all of it. We will filter by group if
// desired. // desired.

View file

@ -127,6 +127,7 @@ class Conversation extends BaseObject {
* _ false on failure * _ false on failure
*/ */
public function get_template_data($alike, $dlike) { public function get_template_data($alike, $dlike) {
global $a;
$result = array(); $result = array();
foreach($this->threads as $item) { foreach($this->threads as $item) {
@ -140,6 +141,7 @@ class Conversation extends BaseObject {
$result[] = $item_data; $result[] = $item_data;
} }
//$a->mark_timestamp();
return $result; return $result;
} }