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


Python cpuinfo.get_cpu_info方法代码示例

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


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

示例1: main

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def main():
    os.system("clear")
    print("\t" + "#" * 80 + "#")
    print("\t" + "#\033[91m\t[*] This is a simple script to show your system information\033[0m\t\t" + "#")
    print("\t" + "#" * 80 + "#")
    print("")

    print("\033[91m\tTime: \033[0m" + time.ctime())
    print("\033[91m\tCurrent directory: \033[0m" + os.getcwd())
    print("\033[91m\tPython Version: \033[0m" + cpuinfo.get_cpu_info()["python_version"])
    print("\033[91m\tOperation System: \033[0m" + platform.system())
    print("\033[91m\tNode: \033[0m" + platform.node())
    print("\033[91m\tOS Version: \033[0m" + platform.uname()[3])
    print("\033[91m\tSystem Type: \033[0m" + platform.architecture()[0])
    print("\033[91m\tCores: \033[0m" + str(cpuinfo.get_cpu_info()["count"]))
    print("\033[91m\tCPU: \033[0m" + cpuinfo.get_cpu_info()["brand"]) 
开发者ID:Naategh,项目名称:PyCk,代码行数:18,代码来源:sysInfo.py

示例2: cpu_info

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def cpu_info(self) -> CpuInfoResponse:
        """
        Get CPU info.
        :return: :class:`platypush.message.response.system.CpuInfoResponse`
        """
        from cpuinfo import get_cpu_info
        info = get_cpu_info()

        return CpuInfoResponse(
            arch=info.get('raw_arch_string'),
            bits=info.get('bits'),
            count=info.get('count'),
            vendor_id=info.get('vendor_id'),
            brand=info.get('brand'),
            hz_advertised=info.get('hz_advertised_raw')[0],
            hz_actual=info.get('hz_actual_raw')[0],
            stepping=info.get('stepping'),
            model=info.get('model'),
            family=info.get('family'),
            flags=info.get('flags'),
            l1_instruction_cache_size=info.get('l1_instruction_cache_size'),
            l1_data_cache_size=info.get('l1_data_cache_size'),
            l2_cache_size=info.get('l2_cache_size'),
            l3_cache_size=info.get('l3_cache_size'),
        ) 
开发者ID:BlackLight,项目名称:platypush,代码行数:27,代码来源:__init__.py

示例3: main

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def main():
    file = open(
        "bench_result" + str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")), "w"
    )
    gen = CubeGen(number_dimensions=3, rows_length=1000, columns_length=5)
    gen.generate_csv(gen.generate_cube(3, 1000))
    mbench = MicBench()
    file.write("Benchmarks are made with cpu :\n")
    file.write(cpuinfo.get_cpu_info()["brand"] + "\n\n")

    mdx_engine = MdxEngine()
    mdx_engine.load_cube(CUBE_NAME)
    wsgi_application = get_wsgi_application(mdx_engine)
    server = WSGIServer(application=wsgi_application, host=HOST, port=PORT)
    server.start()
    provider = xmla.XMLAProvider()
    conn = provider.connect(location=server.url)
    olapy_query_execution_bench(file, mbench, conn, mdx_engine)
    olapy_vs_mondrian(file, mbench, conn)
    olapy_vs_iccube(file, mbench, conn)
    olapy_profile(file)
    gen.remove_temp_cube()
    file.close()
    server.stop() 
开发者ID:abilian,项目名称:olapy,代码行数:26,代码来源:csv_olapy_bench_vs_other_olap_servers.py

示例4: pytest_benchmark_generate_machine_info

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def pytest_benchmark_generate_machine_info():
    python_implementation = platform.python_implementation()
    python_implementation_version = platform.python_version()
    if python_implementation == 'PyPy':
        python_implementation_version = '%d.%d.%d' % sys.pypy_version_info[:3]
        if sys.pypy_version_info.releaselevel != 'final':
            python_implementation_version += '-%s%d' % sys.pypy_version_info[3:]
    return {
        "node": platform.node(),
        "processor": platform.processor(),
        "machine": platform.machine(),
        "python_compiler": platform.python_compiler(),
        "python_implementation": python_implementation,
        "python_implementation_version": python_implementation_version,
        "python_version": platform.python_version(),
        "python_build": platform.python_build(),
        "release": platform.release(),
        "system": platform.system(),
        "cpu": get_cpu_info(),
    } 
开发者ID:ionelmc,项目名称:pytest-benchmark,代码行数:22,代码来源:plugin.py

示例5: get_cpu_model

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def get_cpu_model():
    return cpuinfo.get_cpu_info()['brand'] 
开发者ID:BennyThink,项目名称:ServerSan,代码行数:4,代码来源:ss-agent.py

示例6: get_cpu_freq

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def get_cpu_freq():
    # psutil won't return current cpu freq in visualization.
    # return psutil.cpu_freq()[0]
    return round(float(cpuinfo.get_cpu_info()['hz_actual'].split(' ')[0]), 2) 
开发者ID:BennyThink,项目名称:ServerSan,代码行数:6,代码来源:ss-agent.py

示例7: collect_system_information

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def collect_system_information(self):
        values = {}
        mem = psutil.virtual_memory()
        values['memory_total'] = mem.total

        import cpuinfo
        cpu = cpuinfo.get_cpu_info()
        values['resources_limit'] = self.resources_limit
        values['cpu_name'] = cpu['brand']
        values['cpu'] = [cpu['hz_advertised_raw'][0], cpu['count']]
        values['nets'] = {}
        values['disks'] = {}
        values['gpus'] = {}
        values['boot_time'] = psutil.boot_time()

        try:
            for gpu_id, gpu in enumerate(aetros.cuda_gpu.get_ordered_devices()):
                gpu['available'] = gpu_id in self.enabled_gpus

                values['gpus'][gpu_id] = gpu
        except aetros.cuda_gpu.CudaNotImplementedException: pass

        for disk in psutil.disk_partitions():
            try:
                name = self.get_disk_name(disk[1])
                values['disks'][name] = psutil.disk_usage(disk[1]).total
            except Exception:
                # suppress Operation not permitted
                pass

        try:
            for id, net in psutil.net_if_stats().items():
                if 0 != id.find('lo') and net.isup:
                    self.nets.append(id)
                    values['nets'][id] = net.speed or 1000
        except Exception:
            # suppress Operation not permitted
            pass

        return values 
开发者ID:aetros,项目名称:aetros-cli,代码行数:42,代码来源:ServerCommand.py

示例8: collect_system_information

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def collect_system_information(self):
        import psutil

        mem = psutil.virtual_memory()

        with self.git.batch_commit('JOB_SYSTEM_INFORMATION'):
            self.set_system_info('memory_total', mem.total)

            import cpuinfo
            cpu = cpuinfo.get_cpu_info()
            self.set_system_info('cpu_name', cpu['brand'])
            self.set_system_info('cpu', [cpu['hz_actual_raw'][0], cpu['count']]) 
开发者ID:aetros,项目名称:aetros-cli,代码行数:14,代码来源:backend.py

示例9: _get_cpu_by_pycpuinfo

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def _get_cpu_by_pycpuinfo():
    return cpuinfo.get_cpu_info().get("brand", "Unknown") 
开发者ID:IDSIA,项目名称:sacred,代码行数:4,代码来源:host_info.py

示例10: get_global

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def get_global(key: Optional[str] = None) -> Union[str, Dict[str, Any]]:
    import cpuinfo
    import psutil

    # TODO (wardlt): Implement a means of getting CPU information from compute nodes on clusters for MPI tasks
    #  The QC code runs on a different node than the node running this Python function, which may have different info

    global _global_values
    if _global_values is None:
        _global_values = {}
        _global_values["hostname"] = socket.gethostname()
        _global_values["memory"] = round(psutil.virtual_memory().available / (1024 ** 3), 3)
        _global_values["username"] = getpass.getuser()

        # Work through VMs and logical cores.
        if hasattr(psutil.Process(), "cpu_affinity"):
            cpu_cnt = len(psutil.Process().cpu_affinity())
        else:
            cpu_cnt = psutil.cpu_count(logical=False)
            if cpu_cnt is None:
                cpu_cnt = psutil.cpu_count(logical=True)

        _global_values["ncores"] = cpu_cnt
        _global_values["nnodes"] = 1

        _global_values["cpuinfo"] = cpuinfo.get_cpu_info()
        try:
            _global_values["cpu_brand"] = _global_values["cpuinfo"]["brand_raw"]
        except KeyError:
            # Remove this if py-cpuinfo is pinned to >=6.0.0
            _global_values["cpu_brand"] = _global_values["cpuinfo"]["brand"]

    if key is None:
        return _global_values.copy()
    else:
        return _global_values[key] 
开发者ID:MolSSI,项目名称:QCEngine,代码行数:38,代码来源:config.py

示例11: vendor

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def vendor():
                return cpuinfo.get_cpu_info()['vendor_id'] 
开发者ID:Pardus-LiderAhenk,项目名称:ahenk,代码行数:4,代码来源:system.py

示例12: brand

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def brand():
                return cpuinfo.get_cpu_info()['brand'] 
开发者ID:Pardus-LiderAhenk,项目名称:ahenk,代码行数:4,代码来源:system.py

示例13: hz_advertised

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def hz_advertised():
                return cpuinfo.get_cpu_info()['hz_advertised'] 
开发者ID:Pardus-LiderAhenk,项目名称:ahenk,代码行数:4,代码来源:system.py

示例14: hz_actual

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def hz_actual():
                return cpuinfo.get_cpu_info()['hz_actual'] 
开发者ID:Pardus-LiderAhenk,项目名称:ahenk,代码行数:4,代码来源:system.py

示例15: bit

# 需要导入模块: import cpuinfo [as 别名]
# 或者: from cpuinfo import get_cpu_info [as 别名]
def bit():
                return cpuinfo.get_cpu_info()['bits'] 
开发者ID:Pardus-LiderAhenk,项目名称:ahenk,代码行数:4,代码来源:system.py


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