Changeset 926

Show
Ignore:
Timestamp:
06/05/10 16:24:37 (20 months ago)
Author:
ort
Message:

fix + вынос статистики производительности из index.php в отдельный шаблон

Location:
trunk
Files:
7 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/engine/classes/Engine.class.php

    r907 r926  
    4141        protected $aConfigModule; 
    4242        public $iTimeLoadModule=0; 
     43        protected $iTimeInit=null; 
    4344         
    4445        /** 
     
    5455         */ 
    5556        protected function __construct() { 
     57                $this->iTimeInit=microtime(true); 
    5658                if (get_magic_quotes_gpc()) { 
    5759                        func_stripslashes($_REQUEST); 
     
    394396        public function getStats() { 
    395397                return array('sql'=>$this->Database_GetStats(),'cache'=>$this->Cache_GetStats(),'engine'=>array('time_load_module'=>round($this->iTimeLoadModule,3))); 
     398        } 
     399         
     400        public function GetTimeInit() { 
     401                return $this->iTimeInit; 
    396402        } 
    397403 
  • trunk/engine/classes/Hook.class.php

    r818 r926  
    2626        } 
    2727         
    28         protected function AddHook($sName,$sCallBack,$sClassNameHook,$iPriority=1) { 
     28        protected function AddHook($sName,$sCallBack,$sClassNameHook=null,$iPriority=1) { 
     29                if (is_null($sClassNameHook)) { 
     30                        $sClassNameHook=get_class($this); 
     31                } 
    2932                $this->Hook_AddExecHook($sName,$sCallBack,$iPriority,array('sClassName'=>$sClassNameHook)); 
    3033        } 
    3134         
    32         protected function AddDelegateHook($sName,$sCallBack,$sClassNameHook,$iPriority=1) { 
     35        protected function AddDelegateHook($sName,$sCallBack,$sClassNameHook=null,$iPriority=1) { 
     36                if (is_null($sClassNameHook)) { 
     37                        $sClassNameHook=get_class($this); 
     38                } 
    3339                $this->Hook_AddDelegateHook($sName,$sCallBack,$iPriority,array('sClassName'=>$sClassNameHook)); 
    3440        } 
  • trunk/index.php

    r895 r926  
    2121header('Content-Type: text/html; charset=utf-8'); 
    2222 
    23 $t1=microtime(true); 
    24  
    2523set_include_path(get_include_path().PATH_SEPARATOR.dirname(__FILE__)); 
    2624chdir(dirname(__FILE__)); 
     
    3634$oRouter->Exec(); 
    3735 
    38 $oEngine=Engine::getInstance(); 
    39 $aStats=$oEngine->getStats(); 
    40 $t2=microtime(true); 
    41  
    4236$oProfiler->Stop($iTimeId); 
    4337?> 
    44  
    45 <?php  
    46 $oUser=$oRouter->User_GetUserCurrent(); 
    47 if (Router::GetIsShowStats() and $oUser and $oUser->isAdministrator()) {  
    48 ?> 
    49 <fieldset> 
    50 <legend>Statistics performance</legend> 
    51 <table> 
    52         <tr align="top"> 
    53                 <td align="top"> 
    54                 <ul> 
    55         <li> 
    56         <b>MySql</b> <br> 
    57         &nbsp;&nbsp;&nbsp;query: <?php echo($aStats['sql']['count']);?><br> 
    58         &nbsp;&nbsp;&nbsp;time: <?php echo($aStats['sql']['time']);?><br><br><br> 
    59         </li> 
    60         </ul> 
    61                 </td> 
    62                 <td> 
    63                 <ul> 
    64         <li> 
    65         <b>Cache</b> <br> 
    66         &nbsp;&nbsp;&nbsp;query: <?php echo($aStats['cache']['count']);?><br> 
    67         &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set: <?echo($aStats['cache']['count_set']);?><br> 
    68         &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get: <?echo($aStats['cache']['count_get']);?><br> 
    69         &nbsp;&nbsp;&nbsp;time: <?php echo(round($aStats['cache']['time'],5));?> 
    70         </li> 
    71         </ul> 
    72                 </td> 
    73                 <td align="top"> 
    74                 <ul> 
    75         <li> 
    76         <b>PHP</b> <br>  
    77         &nbsp;&nbsp;&nbsp;time load modules:<?php echo($aStats['engine']['time_load_module']);?><br> 
    78         &nbsp;&nbsp;&nbsp;full time:<?php echo(round($t2-$t1,3));?><br><br><br> 
    79         </li> 
    80         </ul> 
    81                 </td> 
    82         </tr> 
    83 </table> 
    84 </fieldset> 
    85 <p align="center">Profiler: <?php print (Config::Get('sys.logs.profiler')) ? 'On' : 'Off'; ?> | <a href="<?php echo Router::GetPath('profiler');?>">Profiler reports</a></p> 
    86 <?php }?> 
  • trunk/templates/skin/developer/header_top.tpl

    r923 r926  
    4545        </div> 
    4646 
    47  
    48         {* ���*} 
     47         
    4948        <h1><a href="{cfg name='path.root.web'}">LiveStreet</a></h1> 
    5049         
    51  
    52         {* �����*} 
     50         
    5351        <ul class="pages"> 
    5452                <li {if $sMenuHeadItemSelect=='blog'}class="active"{/if}><a href="{router page='blog'}">{$aLang.clean_posts}</a></li> 
    5553                <li {if $sMenuHeadItemSelect=='blogs'}class="active"{/if}><a href="{router page='blogs'}">{$aLang.blogs}</a></li> 
    5654                <li {if $sMenuHeadItemSelect=='people'}class="active"{/if}><a href="{router page='people'}">{$aLang.people}</a></li> 
    57  
    58                 {* ��������Page" *} 
     55                 
    5956                {if $aPluginActive.page} 
    6057                        <li {if $sAction=='page' and $sEvent=='about'}class="active"{/if}><a href="{router page='page'}about/">{$aLang.page_about}</a></li>