/** * @return Singleton instance of the filehandler */ public static function getInstance() { if (self::$singleton == null) { self::$singleton = new self(); } return self::$singleton; }
function pfc_request_get_datafile() { $dataFile = get('dataFile'); if ($dataFile == '0') { $files = Pfc_FileHandler::getInstance()->getTraceList(); $dataFile = $files[0]['filename']; } return $dataFile; }
<?php require './config.php'; require './library/FileHandler.php'; $filename = $_GET['file']; if ($filename == '0') { $files = Pfc_FileHandler::getInstance()->getTraceList(); $filename = $files[0]['filename']; } $format = Pfc_Config::profileOutputFormat(); $matchs = array(); preg_match($format, $filename, $matchs); $urlname = $matchs[3]; $tsvFileName = $urlname . '.tsv'; $dataDir = Pfc_Config::tsvdir(); $realFile = $dataDir . $tsvFileName; $data = file_get_contents($realFile); echo $data;
<?php require './config.php'; require './library/FileHandler.php'; require './library/webpfc_callgraph.php'; //$GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/xhprof_lib'; //include_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php'; ini_set('max_execution_time', 100); $params = array('file' => array(WEBPFC_STRING_PARAM, ''), 'func' => array(WEBPFC_STRING_PARAM, ''), 'type' => array(WEBPFC_STRING_PARAM, 'png'), 'threshold' => array(WEBPFC_FLOAT_PARAM, 0.01), 'critical' => array(WEBPFC_BOOL_PARAM, true)); // pull values of these params, and create named globals for each param webpfc_param_init($params); // if invalid value specified for threshold, then use the default if ($threshold < 0 || $threshold > 1) { $threshold = $params['threshold'][1]; } // if invalid value specified for type, use the default if (!array_key_exists($type, $webpfc_legal_image_types)) { $type = $params['type'][1]; // default image type. } if ($file == '0') { $files = Pfc_FileHandler::getInstance()->getTraceList(); $file = $files[0]['filename']; } $raw_data = Pfc_FileHandler::getInstance()->getProfileDataRaw($file, 'ms'); webpfc_render_image($raw_data, $func, $type, $threshold, $critical);