function pfc_ajax_get_history_profiles($dataFile) { $result = array(); $matchs = array(); preg_match(Pfc_Config::profileOutputFormat(), $dataFile, $matchs); $urlname = $matchs[3]; $timestamp = $matchs[2]; $realPath = Pfc_Config::profileDir() . '/' . $urlname; if (file_exists($realPath)) { $files = preg_grep(Pfc_Config::profileOutputFormat(), scandir($realPath)); foreach ($files as $file) { $result[] = array('filename' => $file, 'mtime' => date("Y-m-d H:i:s", substr($file, 8, 10))); } } return json_encode($result); }
<?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;
static function profileDir() { return Pfc_Config::storageDir() . '/profile'; }
public function getProfileDataRaw($file, $type = 'current') { $dir = ''; if ($type == 'history') { $fileInfo = $this->parseFilename($file); $dir = $fileInfo['urlname']; if (strlen($dir)) { $dir .= '/'; } } //echo '---------------------dir-'.$dir; $realFile = Pfc_Config::profileDir() . '/' . $dir . $file; if (!file_exists($realFile)) { error_log("Could not find file {$realFile}"); return null; } $contents = file_get_contents($realFile); return unserialize($contents); }
<?php require './config.php'; require_once 'convert.php'; $sclogDir = Pfc_Config::storageDir() . "/" . "sclog"; $dataFile = $_GET['dataFile']; $dataFile = str_replace('pfc.out', 'pfc.sclog', $dataFile); $realPaht = $sclogDir . "/" . $dataFile; $rawData = file_get_contents($realPaht); $barData = getResultData($rawData, 600); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="styles/d3drawarea.css"> <script src="js/d3.v3.min.js"></script> </head> <body> <script type="text/javascript" charset="utf-8"> var margin = {top: 20, right: 20, bottom: 30, left: 50}, width = 800 - margin.left - margin.right, height = 8000 - margin.top - margin.bottom; var svg = d3.select("body").append("svg") .attr("class", "chart") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")");