当前位置: 首页>>代码示例>>PHP>>正文


PHP CpuDevice::setBogomips方法代码示例

本文整理汇总了PHP中CpuDevice::setBogomips方法的典型用法代码示例。如果您正苦于以下问题:PHP CpuDevice::setBogomips方法的具体用法?PHP CpuDevice::setBogomips怎么用?PHP CpuDevice::setBogomips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CpuDevice的用法示例。


在下文中一共展示了CpuDevice::setBogomips方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _cpuinfo

 /**
  * CPU information
  * All of the tags here are highly architecture dependant.
  *
  * @return void
  */
 private function _cpuinfo()
 {
     if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
         $processors = preg_split('/\\s?\\n\\s?\\n/', trim($bufr));
         foreach ($processors as $processor) {
             $dev = new CpuDevice();
             $details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($details as $detail) {
                 $arrBuff = preg_split('/\\s+:\\s+/', trim($detail));
                 if (count($arrBuff) == 2) {
                     switch (strtolower($arrBuff[0])) {
                         case 'processor':
                             if (PSI_LOAD_BAR) {
                                 $dev->setLoad($this->_parseProcStat('cpu' . trim($arrBuff[1])));
                             }
                             break;
                         case 'model name':
                         case 'cpu':
                             $dev->setModel($arrBuff[1]);
                             break;
                         case 'cpu mhz':
                         case 'clock':
                             $dev->setCpuSpeed($arrBuff[1]);
                             break;
                         case 'cycle frequency [hz]':
                             $dev->setCpuSpeed($arrBuff[1] / 1000000);
                             break;
                         case 'cpu0clktck':
                             $dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000);
                             // Linux sparc64
                             break;
                         case 'l2 cache':
                         case 'cache size':
                             $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
                             break;
                         case 'bogomips':
                         case 'cpu0bogo':
                             $dev->setBogomips($arrBuff[1]);
                             break;
                         case 'flags':
                             if (preg_match("/vmx/", $arrBuff[1])) {
                                 $dev->setVirt("vmx");
                             } else {
                                 if (preg_match("/smv/", $arrBuff[1])) {
                                     $dev->setVirt("smv");
                                 }
                             }
                             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)) {
                     $dev->setCache(base_convert($buf, 16, 10));
                 }
             }
             // sparc64 specific code ends
             // XScale detection code
             if ($dev->getModel() === "") {
                 foreach ($details as $detail) {
                     $arrBuff = preg_split('/\\s+:\\s+/', trim($detail));
                     if (count($arrBuff) == 2) {
                         switch (strtolower($arrBuff[0])) {
                             case 'processor':
                                 $dev->setModel($arrBuff[1]);
                                 break;
                             case 'bogomips':
                                 $dev->setCpuSpeed($arrBuff[1]);
                                 //BogoMIPS are not BogoMIPS on this CPU, it's the speed
                                 $dev->setBogomips(null);
                                 // no BogoMIPS available, unset previously set BogoMIPS
                                 break;
                             case 'i size':
                             case 'd size':
                                 if ($dev->getCache() === null) {
                                     $dev->setCache($arrBuff[1] * 1024);
                                 } else {
                                     $dev->setCache($dev->getCache() + $arrBuff[1] * 1024);
                                 }
                                 break;
                         }
                     }
                 }
             }
             if (CommonFunctions::rfts('/proc/acpi/thermal_zone/THRM/temperature', $buf, 1, 4096, false)) {
                 $dev->setTemp(substr($buf, 25, 2));
             }
             if ($dev->getModel() === "") {
                 $dev->setModel("unknown");
//.........这里部分代码省略.........
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:101,代码来源:class.Linux.inc.php

示例2: _cpuinfo

    /**
     * CPU information
     * All of the tags here are highly architecture dependant.
     *
     * @return void
     */
    protected function _cpuinfo()
    {
        if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
            $processors = preg_split('/\s?\n\s?\n/', trim($bufr));
            $procname = null;
            foreach ($processors as $processor) {
                $proc = null;
                $arch = null;
                $dev = new CpuDevice();
                $details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
                foreach ($details as $detail) {
                    $arrBuff = preg_split('/\s*:\s*/', trim($detail));
                    if (count($arrBuff) == 2) {
                        switch (strtolower($arrBuff[0])) {
                        case 'processor':
                            $proc = trim($arrBuff[1]);
                            if (is_numeric($proc)) {
                                if (strlen($procname)>0) {
                                    $dev->setModel($procname);
                                }
                            } else {
                                $procname = $proc;
                                $dev->setModel($procname);
                            }
                            break;
                        case 'model name':
                        case 'cpu model':
                        case 'cpu':
                            $dev->setModel($arrBuff[1]);
                            break;
                        case 'cpu mhz':
                        case 'clock':
                            if ($arrBuff[1] > 0) { //openSUSE fix
                                $dev->setCpuSpeed($arrBuff[1]);
                            }
                            break;
                        case 'cycle frequency [hz]':
                            $dev->setCpuSpeed($arrBuff[1] / 1000000);
                            break;
                        case 'cpu0clktck':
                            $dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000); // Linux sparc64
                            break;
                        case 'l2 cache':
                        case 'cache size':
                            $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
                            break;
                        case 'initial bogomips':
                        case 'bogomips':
                        case 'cpu0bogo':
                            $dev->setBogomips($arrBuff[1]);
                            break;
                        case 'flags':
                            if (preg_match("/ vmx/",$arrBuff[1])) {
                                $dev->setVirt("vmx");
                            } elseif (preg_match("/ svm/",$arrBuff[1])) {
                                $dev->setVirt("svm");
                            } elseif (preg_match("/ hypervisor/",$arrBuff[1])) {
                                $dev->setVirt("hypervisor");
                            }
                            break;
                        case 'i size':
                        case 'd size':
                            if ($dev->getCache() === null) {
                                $dev->setCache($arrBuff[1] * 1024);
                            } else {
                                $dev->setCache($dev->getCache() + ($arrBuff[1] * 1024));
                            }
                            break;
                        case 'cpu architecture':
                            $arch = trim($arrBuff[1]);
                            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)) {
                        $dev->setCache(base_convert($buf, 16, 10));
                    }
                }
                // sparc64 specific code ends

                // XScale detection code
                if (($arch === "5TE") && ($dev->getBogomips() != null)) {
                    $dev->setCpuSpeed($dev->getBogomips()); //BogoMIPS are not BogoMIPS on this CPU, it's the speed
                    $dev->setBogomips(null); // no BogoMIPS available, unset previously set BogoMIPS
                }

                if ($proc != null) {
                    if (!is_numeric($proc)) {
//.........这里部分代码省略.........
开发者ID:rhertzog,项目名称:lcs,代码行数:101,代码来源:class.Linux.inc.php

示例3: _cpuinfo

 /**
  * CPU information
  * All of the tags here are highly architecture dependant
  *
  * @return void
  */
 private function _cpuinfo()
 {
     if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
         $processors = preg_split('/\\s?\\n\\s?\\n/', trim($bufr));
         foreach ($processors as $processor) {
             $dev = new CpuDevice();
             $details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($details as $detail) {
                 $arrBuff = preg_split('/\\s+:\\s+/', trim($detail));
                 if (count($arrBuff) == 2) {
                     switch (strtolower($arrBuff[0])) {
                         case 'model name':
                         case 'cpu':
                             $dev->setModel($arrBuff[1]);
                             break;
                         case 'cpu mhz':
                         case 'clock':
                             $dev->setCpuSpeed($arrBuff[1]);
                             break;
                         case 'cycle frequency [hz]':
                             $dev->setCpuSpeed($arrBuff[1] / 1000000);
                             break;
                         case 'cpu0clktck':
                             $dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000);
                             // Linux sparc64
                             break;
                         case 'l2 cache':
                         case 'cache size':
                             $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
                             break;
                         case 'bogomips':
                         case 'cpu0bogo':
                             $dev->setBogomips($arrBuff[1]);
                             break;
                     }
                 }
             }
         }
     }
 }
开发者ID:antirek,项目名称:prestige-pbx,代码行数:46,代码来源:class.HPUX.inc.php

示例4: _cpuinfo


//.........这里部分代码省略.........
                                     }
                                 } else {
                                     $procname = $proc;
                                     $dev->setModel($procname);
                                 }
                                 break;
                             case 'model name':
                             case 'cpu model':
                             case 'cpu type':
                             case 'cpu':
                                 $dev->setModel($arrBuff1);
                                 break;
                             case 'cpu mhz':
                             case 'clock':
                                 if ($arrBuff1 > 0) {
                                     //openSUSE fix
                                     $dev->setCpuSpeed($arrBuff1);
                                 }
                                 break;
                             case 'cycle frequency [hz]':
                                 $dev->setCpuSpeed($arrBuff1 / 1000000);
                                 break;
                             case 'cpu0clktck':
                                 $dev->setCpuSpeed(hexdec($arrBuff1) / 1000000);
                                 // Linux sparc64
                                 break;
                             case 'l2 cache':
                             case 'cache size':
                                 $dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff1) * 1024);
                                 break;
                             case 'initial bogomips':
                             case 'bogomips':
                             case 'cpu0bogo':
                                 $dev->setBogomips(round($arrBuff1));
                                 break;
                             case 'flags':
                                 if (preg_match("/ vmx/", $arrBuff1)) {
                                     $dev->setVirt("vmx");
                                 } elseif (preg_match("/ svm/", $arrBuff1)) {
                                     $dev->setVirt("svm");
                                 } elseif (preg_match("/ hypervisor/", $arrBuff1)) {
                                     $dev->setVirt("hypervisor");
                                 }
                                 break;
                             case 'i size':
                             case 'd size':
                                 if ($dev->getCache() === null) {
                                     $dev->setCache($arrBuff1 * 1024);
                                 } else {
                                     $dev->setCache($dev->getCache() + $arrBuff1 * 1024);
                                 }
                                 break;
                             case 'cpu architecture':
                                 $arch = $arrBuff1;
                                 break;
                             case 'cpu implementer':
                                 $impl = $arrBuff1;
                                 break;
                             case 'cpu part':
                                 $part = $arrBuff1;
                                 break;
                         }
                     }
                 }
                 if ($arch === null) {
                     $arch = $_arch;
开发者ID:phpsysinfo,项目名称:phpsysinfo,代码行数:67,代码来源:class.Linux.inc.php


注:本文中的CpuDevice::setBogomips方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。