[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/xhprof/xhprof_html/ -> index.php (source)

   1  <?php
   2  //  Copyright (c) 2009 Facebook
   3  //
   4  //  Licensed under the Apache License, Version 2.0 (the "License");
   5  //  you may not use this file except in compliance with the License.
   6  //  You may obtain a copy of the License at
   7  //
   8  //      http://www.apache.org/licenses/LICENSE-2.0
   9  //
  10  //  Unless required by applicable law or agreed to in writing, software
  11  //  distributed under the License is distributed on an "AS IS" BASIS,
  12  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13  //  See the License for the specific language governing permissions and
  14  //  limitations under the License.
  15  //
  16  
  17  //
  18  // XHProf: A Hierarchical Profiler for PHP
  19  //
  20  // XHProf has two components:
  21  //
  22  //  * This module is the UI/reporting component, used
  23  //    for viewing results of XHProf runs from a browser.
  24  //
  25  //  * Data collection component: This is implemented
  26  //    as a PHP extension (XHProf).
  27  //
  28  //
  29  //
  30  // @author(s)  Kannan Muthukkaruppan
  31  //             Changhao Jiang
  32  //
  33  
  34  // Start moodle modification: moodleize this script.
  35  require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
  36  require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
  37  require_login();
  38  require_capability('moodle/site:config', context_system::instance());
  39  \core\session\manager::write_close();
  40  // End moodle modification.
  41  
  42  // by default assume that xhprof_html & xhprof_lib directories
  43  // are at the same level.
  44  $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib';
  45  
  46  require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php';
  47  
  48  // param name, its type, and default value
  49  $params = array('run'        => array(XHPROF_STRING_PARAM, ''),
  50                  'wts'        => array(XHPROF_STRING_PARAM, ''),
  51                  'symbol'     => array(XHPROF_STRING_PARAM, ''),
  52                  'sort'       => array(XHPROF_STRING_PARAM, 'wt'), // wall time
  53                  'run1'       => array(XHPROF_STRING_PARAM, ''),
  54                  'run2'       => array(XHPROF_STRING_PARAM, ''),
  55                  'source'     => array(XHPROF_STRING_PARAM, 'xhprof'),
  56                  'all'        => array(XHPROF_UINT_PARAM, 0),
  57                  );
  58  
  59  // pull values of these params, and create named globals for each param
  60  xhprof_param_init($params);
  61  
  62  /* reset params to be a array of variable names to values
  63     by the end of this page, param should only contain values that need
  64     to be preserved for the next page. unset all unwanted keys in $params.
  65   */
  66  foreach ($params as $k => $v) {
  67    $params[$k] = $$k;
  68  
  69    // unset key from params that are using default values. So URLs aren't
  70    // ridiculously long.
  71    if ($params[$k] == $v[1]) {
  72      unset($params[$k]);
  73    }
  74  }
  75  
  76  echo "<html>";
  77  
  78  echo "<head><title>XHProf: Hierarchical Profiler Report</title>";
  79  xhprof_include_js_css();
  80  echo "</head>";
  81  
  82  echo "<body>";
  83  
  84  $vbar  = ' class="vbar"';
  85  $vwbar = ' class="vwbar"';
  86  $vwlbar = ' class="vwlbar"';
  87  $vbbar = ' class="vbbar"';
  88  $vrbar = ' class="vrbar"';
  89  $vgbar = ' class="vgbar"';
  90  
  91  // Start moodle modification: use own XHProfRuns implementation.
  92  // $xhprof_runs_impl = new XHProfRuns_Default();
  93  $xhprof_runs_impl = new moodle_xhprofrun();
  94  // End moodle modification.
  95  
  96  displayXHProfReport($xhprof_runs_impl, $params, $source, $run, $wts,
  97                      $symbol, $sort, $run1, $run2);
  98  
  99  
 100  echo "</body>";
 101  echo "</html>";


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1