Commit faa6e9e0 authored by Zixian Cai's avatar Zixian Cai

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