include_once 'ressources/class.mysql.inc'; include_once 'ressources/class.artica.graphs.inc'; $users = new usersMenus(); if (!$users->AsSystemAdministrator) { die; } if (isset($_GET["all"])) { js(); exit; } if (isset($_GET["tabs"])) { tabs(); exit; } if (isset($_GET["hour"])) { hour(); exit; } if (isset($_GET["today"])) { today(); exit; } if (isset($_GET["week"])) { week(); exit; } if (isset($_POST["LoadAvgClean"])) { LoadAvgClean(); exit; } function js()
<?php if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);} include_once('ressources/class.templates.inc'); session_start(); include_once('ressources/class.html.pages.inc'); include_once('ressources/class.mysql.inc'); include_once('ressources/class.artica.graphs.inc'); $users=new usersMenus(); if(!$users->AsSystemAdministrator){die();} if(isset($_GET["all"])){js();exit;} if(isset($_GET["tabs"])){tabs();exit;} if(isset($_GET["hour"])){hour();exit;} if(isset($_GET["today"])){today();exit;} if(isset($_GET["week"])){week();exit;} function js(){ $page=CurrentPageName(); $tpl=new templates(); $title=$tpl->_ENGINE_parse_body("{computer_load}"); echo "YahooWin3('750','$page?tabs=yes','$title')"; } function tabs(){ $tpl=new templates(); $array["hour"]='{last_hour}'; $array["today"]='{last_24h}';
public static function generateStreamIDHash($url, $deterministic) { // For load balancing purposes, the hash should be spread as randomly // as possible. if ($deterministic) { // randomize deterministically: $randomize = self::createHash($url); } else { // randomize based on current time: $randomize(hour(now) & minute(now) & second(now)); } $streamidhash = 0; srand(); // generate random serial number between 0 and 15 $streamidhash = rand(0, 15); //echo "DEBUG: Raw streamidhash is $streamidhash\n"; $streamidhash = dechex($streamidhash); return $streamidhash; }
die('Could not SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL); } $n = mysql_num_rows($b); if (!$n) { die('No results returned in SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL); } } $t = mtime() - $tStart; print hour() . ' SELECT (' . $n . ' rows) complete in ' . $t . ' seconds with an average of ' . $t / $nLoop . ' sec/query' . "\n"; flush(); ////////////////////////////////////// print hour() . ' Idem, maar dan met subqueries' . "\n"; flush(); $tStart = mtime(); $sSQL = 'SELECT SQL_NO_CACHE c.*, SUBSTRING_INDEX(c.id, "/", 1) AS category, SUBSTRING(c.id, LOCATE("/", c.id)+1) AS colid, (SELECT a.created_by > 0 FROM ' . TABLE_ACTIVE_COLS . ' AS a WHERE c.id = a.colid) AS active, (SELECT u.name FROM ' . TABLE_USERS . ' AS u WHERE c.created_by = u.id) AS created_by_ FROM ' . TABLE_COLS . ' AS c ORDER BY category, colid'; for ($i = 1; $i <= $nLoop; $i++) { $b = @mysql_query($sSQL); if (!$b) { die('Could not SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL); } $n = mysql_num_rows($b); if (!$n) { die('No results returned in SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL); } } $t = mtime() - $tStart; print hour() . ' SELECT (' . $n . ' rows) complete in ' . $t . ' seconds with an average of ' . $t / $nLoop . ' sec/query' . "\n"; flush(); ////////////////////////////////////// exit; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$iSet = $i; $tSet = mtime(); } } $t = mtime() - $tStart; print hour() . ' Data inserted in ' . $t . ' seconds with an average of ' . $t / $n . ' sec/query' . "\n"; flush(); ////////////////////////////////////// print hour() . ' Inserting data...' . "\n"; flush(); $tStart = mtime(); $iSet = 0; $tSet = $tStart; for ($i = 1; $i <= $n; $i++) { $b = @mysql_query('INSERT INTO benchmark_data_text VALUES ("' . generate_random_string(100) . '")'); if (!$b) { die('Could not insert into TEXT table: ' . mysql_error()); } if (!($i % $nSteps)) { print hour() . ' Inserted ' . $i . ' ' . (mtime() - $tSet) / ($i - $iSet) . ' seconds/query' . "\n"; flush(); $iSet = $i; $tSet = mtime(); } } $t = mtime() - $tStart; print hour() . ' Data inserted in ' . $t . ' seconds with an average of ' . $t / $n . ' sec/query' . "\n"; flush(); ////////////////////////////////////// print hour() . ' Done.' . "\n";
function format_Time($timeStr, $nType) { $y = ''; $m = ''; $d = ''; $h = ''; $mi = ''; $s = ''; $format_Time = ''; if (isDate($timeStr) == false) { return @$format_Time; } $y = cStr(year($timeStr)); $m = cStr(month($timeStr)); if (len($m) == 1) { $m = '0' . $m; } $d = cStr(day($timeStr)); //在vb.net里要这样用 D = CStr(CDate(timeStr).Day) if (len($d) == 1) { $d = '0' . $d; } $h = cStr(hour($timeStr)); if (len($h) == 1) { $h = '0' . $h; } $mi = cStr(minute($timeStr)); if (len($mi) == 1) { $mi = '0' . $mi; } $s = cStr(second($timeStr)); if (len($s) == 1) { $s = '0' . $s; } switch ($nType) { case 1: //yyyy-mm-dd hh:mm:ss $format_Time = $y . '-' . $m . '-' . $d . ' ' . $h . ':' . $mi . ':' . $s; break; case 2: //yyyy-mm-dd $format_Time = $y . '-' . $m . '-' . $d; break; case 3: //hh:mm:ss $format_Time = $h . ':' . $mi . ':' . $s; break; case 4: //yyyy年mm月dd日 $format_Time = $y . '年' . $m . '月' . $d . '日'; break; case 5: //yyyymmdd $format_Time = $y . $m . $d; break; case 6: //yyyymmddhhmmss $format_Time = $y . $m . $d . $h . $mi . $s; break; case 7: //mm-dd $format_Time = $m . '-' . $d; break; case 8: //yyyy年mm月dd日 $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ':' . $s; break; case 9: //yyyy年mm月dd日H时mi分S秒 早上 $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒,' . getDayStatus($h, 1); break; case 10: //yyyy年mm月dd日H时 $format_Time = $y . '年' . $m . '月' . $d . '日' . $h . '时'; break; case 11: //yyyy年mm月dd日H时mi分S秒 $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒'; break; case 12: //yyyy年mm月dd日H时mi分 $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分'; break; case 13: //yyyy年mm月dd日H时mi分 早上 $format_Time = $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ' ' . getDayStatus($h, 0); break; case 14: //yyyy年mm月dd日 $format_Time = $y . '/' . $m . '/' . $d; break; case 15: //yyyy年mm月 第1周 $format_Time = $y . '年' . $m . '月 第' . GetCountPage($d, 7) . '周'; } return @$format_Time; }