WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit faa6e9e0 authored by Zixian Cai's avatar Zixian Cai
Browse files

Read entire cpuinfo instead of just model name on Linux

parent 993e7383
......@@ -15,7 +15,7 @@
import logging
from mubench.models.pipeline import pipelines
from mubench.util import get_cpu_model, get_hostname, get_uname
from mubench.util import get_cpu_info, get_hostname, get_uname
logger = logging.getLogger(__name__)
......@@ -28,7 +28,7 @@ def go_through_pipelines(report, pipeline_names):
def platform_info():
return {
"cpu": get_cpu_model(),
"cpu": get_cpu_info(),
"uname": get_uname(),
"hostname": get_hostname()
......@@ -81,13 +81,10 @@ def add_path_to_ld_library_path(path_s, env):
env[libpath_var] = "%s:%s" % (path_s, env.get(libpath_var, ""))
def get_cpu_model():
def get_cpu_info():
if platform.system() == "Linux":
with open("/proc/cpuinfo") as cpuinfo:
lines = cpuinfo.read()
models = [x for x in lines.split("\n") if
x.startswith("model name")]
return models[0].split("\t")[1][2:]
return cpuinfo.read()
elif platform.system() == "Darwin":
cmd = "sysctl -n machdep.cpu.brand_string"
return subprocess.check_output(cmd.split()).decode("utf-8").strip()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment