Changeset 3386

Show
Ignore:
Timestamp:
08/29/2008 09:49:20 AM (3 months ago)
Author:
Shadowhand
Message:

Moved some benchmarks around, added utf8_conversion benchmark, removed kohana_loading benchmark

Location:
trunk/system
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/bootstrap.php

    r3366 r3386  
    1414define('KOHANA_CODENAME', 'kernachtig'); 
    1515 
    16 // Test of Kohana is running in Windows 
    17 define('KOHANA_IS_WIN', PHP_SHLIB_SUFFIX === 'dll'); 
    18  
    1916// Kohana benchmarks are prefixed to prevent collisions 
    2017define('SYSTEM_BENCHMARK', 'system_benchmark'); 
     
    2623Benchmark::start(SYSTEM_BENCHMARK.'_total_execution'); 
    2724 
    28 // Start kohana_loading 
    29 Benchmark::start(SYSTEM_BENCHMARK.'_kohana_loading'); 
     25// Start environment_test 
     26Benchmark::start(SYSTEM_BENCHMARK.'_environment_test'); 
     27 
     28// Test of Kohana is running in Windows 
     29define('KOHANA_IS_WIN', PHP_SHLIB_SUFFIX === 'dll'); 
    3030 
    3131// Check UTF-8 support 
     
    7979} 
    8080 
     81// Stop environment_test 
     82Benchmark::stop(SYSTEM_BENCHMARK.'_environment_test'); 
     83 
     84// Start system_initialization 
     85Benchmark::start(SYSTEM_BENCHMARK.'_system_initialization'); 
     86 
    8187// Load utf8 support 
    8288require SYSPATH.'classes/utf8'.EXT; 
     89 
     90// Load Event support 
     91require SYSPATH.'classes/event'.EXT; 
     92 
     93// Load Kohana core 
     94require SYSPATH.'classes/kohana'.EXT; 
     95 
     96// Start utf8_conversion 
     97Benchmark::start(SYSTEM_BENCHMARK.'_utf8_conversion'); 
    8398 
    8499// Convert all global variables to UTF-8. 
     
    94109} 
    95110 
    96 // Load Event support 
    97 require SYSPATH.'classes/event'.EXT; 
    98  
    99 // Load Kohana core 
    100 require SYSPATH.'classes/kohana'.EXT; 
     111// Stop utf8_conversion 
     112Benchmark::stop(SYSTEM_BENCHMARK.'_utf8_conversion'); 
    101113 
    102114// Prepare the environment 
    103115Kohana::setup(); 
    104  
    105 // End kohana_loading 
    106 Benchmark::stop(SYSTEM_BENCHMARK.'_kohana_loading'); 
    107  
    108 // Start system_initialization 
    109 Benchmark::start(SYSTEM_BENCHMARK.'_system_initialization'); 
    110116 
    111117// Prepare the system 
  • trunk/system/classes/kohana.php

    r3367 r3386  
    7777                        return; 
    7878 
    79                 // Start the environment setup benchmark 
    80                 Benchmark::start(SYSTEM_BENCHMARK.'_environment_setup'); 
    81  
    8279                // Define Kohana error constant 
    8380                define('E_KOHANA', 42); 
     
    10299                } 
    103100 
    104                 // Disable notices and "strict" errors 
    105                 $ER = error_reporting(~E_NOTICE & ~E_STRICT); 
     101                // Send default text/html UTF-8 header 
     102                header('Content-Type: text/html; charset=UTF-8'); 
     103 
     104                // Enable exception handling 
     105                Kohana_Exception::enable(); 
     106 
     107                // Enable error handling 
     108                Kohana_PHP_Exception::enable(); 
     109 
     110                if (self::$configuration['core']['log_threshold'] > 0) 
     111                { 
     112                        // Set the log directory 
     113                        self::log_directory(self::$configuration['core']['log_directory']); 
     114 
     115                        // Enable log writing at shutdown 
     116                        register_shutdown_function(array(__CLASS__, 'log_save')); 
     117                } 
    106118 
    107119                // Set the user agent 
    108120                self::$user_agent = trim($_SERVER['HTTP_USER_AGENT']); 
    109121 
    110                 if (function_exists('date_default_timezone_set')) 
    111                 { 
    112                         $timezone = Kohana::config('locale.timezone'); 
    113  
    114                         // Set default timezone, due to increased validation of date settings 
    115                         // which cause massive amounts of E_NOTICEs to be generated in PHP 5.2+ 
    116                         date_default_timezone_set(empty($timezone) ? date_default_timezone_get() : $timezone); 
    117                 } 
    118  
    119                 // Restore error reporting 
    120                 error_reporting($ER); 
     122                if ( ! ($timezone = Kohana::config('locale.timezone'))) 
     123                { 
     124                        // Disable notices and "strict" errors, due to the E_NOTICE that 
     125                        // will be generated in PHP 5.2+ 
     126                        $ER = error_reporting(~E_NOTICE & ~E_STRICT); 
     127 
     128                        // Get the default timezone 
     129                        $timezone = date_default_timezone_get(); 
     130 
     131                        // Restore error reporting 
     132                        error_reporting($ER); 
     133                } 
     134 
     135                // Set the default timezone 
     136                date_default_timezone_set($timezone); 
    121137 
    122138                // Start output buffering 
     
    126142                self::$buffer_level = ob_get_level(); 
    127143 
    128                 // Send default text/html UTF-8 header 
    129                 header('Content-Type: text/html; charset=UTF-8'); 
    130  
    131144                // Set autoloader 
    132145                spl_autoload_register(array('Kohana', 'auto_load')); 
    133  
    134                 // Enable exception handling 
    135                 Kohana_Exception::enable(); 
    136  
    137                 // Enable error handling 
    138                 Kohana_PHP_Exception::enable(); 
    139  
    140                 if (self::$configuration['core']['log_threshold'] > 0) 
    141                 { 
    142                         // Set the log directory 
    143                         self::log_directory(self::$configuration['core']['log_directory']); 
    144  
    145                         // Enable log writing at shutdown 
    146                         register_shutdown_function(array(__CLASS__, 'log_save')); 
    147                 } 
    148146 
    149147                // Load locales 
     
    171169                if ($config = Kohana::config('core.enable_hooks')) 
    172170                { 
     171                        // Start the loading_hooks routine 
     172                        Benchmark::start(SYSTEM_BENCHMARK.'_loading_hooks'); 
     173 
    173174                        $hooks = array(); 
    174175 
     
    213214                                } 
    214215                        } 
     216 
     217                        // Stop the loading_hooks routine 
     218                        Benchmark::stop(SYSTEM_BENCHMARK.'_loading_hooks'); 
    215219                } 
    216220 
    217221                // Setup is complete, prevent it from being run again 
    218222                $run = TRUE; 
    219  
    220                 // Stop the environment setup routine 
    221                 Benchmark::stop(SYSTEM_BENCHMARK.'_environment_setup'); 
    222223        } 
    223224