本文整理汇总了PHP中CommonFunctions::ArrayToXML方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::ArrayToXML方法的具体用法?PHP CommonFunctions::ArrayToXML怎么用?PHP CommonFunctions::ArrayToXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::ArrayToXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCPUInformations
//.........这里部分代码省略.........
break;
case 'cpu':
$results['model'] = $value; // For PPC arch (damn borked POS)
break;
case 'L2 cache':
$results['cache'] = $value * 1024; // More for PPC
break;
case 'revision':
$results['model'] .= ' ( rev: '.$value.')'; // For PPC arch (damn borked POS)
break;
case 'cpu model':
$results['model'] .= ' ('.$value.')'; // For Alpha arch - 2.2.x
break;
case 'cache size':
$results['cache'] = (preg_replace("/[a-zA-Z]/", "", $value)) * 1024;
break;
case 'bogomips':
$results['bogomips'] += $value;
break;
case 'BogoMIPS':
$results['bogomips'] += $value; // For alpha arch - 2.2.x
break;
case 'BogoMips':
$results['bogomips'] += $value; // For sparc arch
break;
case 'cpus detected':
$results['cpus'] += $value; // For Alpha arch - 2.2.x
break;
case 'system type':
$results['model'] .= ', '.$value.' '; // Alpha arch - 2.2.x
break;
case 'platform string':
$results['model'] .= ' ('.$value.')'; // Alpha arch - 2.2.x
break;
case 'processor':
$results['cpus'] += 1;
break;
case 'Cpu0ClkTck':
$results['cpuspeed'] = sprintf('%.2f', hexdec($value) / 1000000); // Linux sparc64
break;
case 'Cpu0Bogo':
$results['bogomips'] += $value; // Linux sparc64 & sparc32
break;
case 'ncpus probed':
$results['cpus'] = $value; // Linux sparc64 & sparc32
break;
}
}
}
// sparc64 specific code follows
// This adds the ability to display the cache that a CPU has
// Originally made by Sven Blumenstein <bazik@gentoo.org> in 2004
// Modified by Tom Weustink <freshy98@gmx.net> in 2004
$sparclist = array('SUNW,UltraSPARC@0,0', 'SUNW,UltraSPARC-II@0,0', 'SUNW,UltraSPARC@1c,0', 'SUNW,UltraSPARC-IIi@1c,0', 'SUNW,UltraSPARC-II@1c,0', 'SUNW,UltraSPARC-IIe@0,0');
foreach ($sparclist as $name) {
if (CommonFunctions::rfts('/proc/openprom/'.$name.'/ecache-size', $buf, 1, 32, false)) {
$results['cache'] = base_convert($buf, 16, 10);
}
}
// sparc64 specific code ends
// XScale detection code
if ($results['cpus'] == 0) {
foreach ($bufe as $buf) {
$fields = preg_split('/\s*:\s*/', trim($buf), 2);
if (sizeof($fields) == 2) {
list($key, $value) = $fields;
switch ($key) {
case 'Processor':
$results['cpus'] += 1;
$results['model'] = $value;
break;
case 'BogoMIPS':
$results['cpuspeed'] = $value; //BogoMIPS are not BogoMIPS on this CPU, it's the speed, no BogoMIPS available
break;
case 'I size':
$results['cache'] = $value * 1024;
break;
case 'D size':
$results['cache'] += $value * 1024;
break;
}
}
}
}
}
$keys = array_keys($results);
$keys2be = array('model', 'cpuspeed', 'cpus');
while ($ar_buf = each($keys2be)) {
if (!in_array($ar_buf[1], $keys)) {
$results[$ar_buf[1]] = '0';
}
}
if (CommonFunctions::rfts('/proc/acpi/thermal_zone/THRM/temperature', $buf, 1, 4096, false)) {
$results['temp'] = substr($buf, 25, 2);
}
//$results['CPULoad'] = $this->CPULoad();
return CommonFunctions::ArrayToXML(array($results), 'CPUInformations');
}