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.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

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

Fetch various system information

parent 8371fe5a
......@@ -201,15 +201,15 @@ class TaskSet:
self.results = {task.name: task.get_result() for task in data}
return self.results
def get_json_log(self):
jslog = {
def get_log(self):
log = {
'name': self.name,
'iterations': self.iterations,
'benchmark': self.benchmark,
'callback': {k: self.callback[k] for k in ('name', 'param')},
'datapoints': {t.name: t.stats for t in self.tasks},
}
return jslog
return log
class Task:
......
......@@ -15,11 +15,12 @@
from string import Template
import os
import subprocess
import logging
import subprocess as subproc
import platform
from types import SimpleNamespace
logger = logging.getLogger(__name__)
......@@ -54,7 +55,7 @@ class ExecutionFailure(Exception):
def run_in_subproc(cmd, env=None, **kwds):
cmd = list(map(str, cmd))
logger.info(" ".join(cmd))
import resource
ru0 = resource.getrusage(resource.RUSAGE_CHILDREN)
t0 = ru0.ru_utime + ru0.ru_stime
......@@ -62,8 +63,8 @@ def run_in_subproc(cmd, env=None, **kwds):
res = subproc.Popen(cmd, stdout=subproc.PIPE, stderr=subproc.PIPE,
env=env, **kwds)
so, se = res.communicate()
res = SimpleNamespace(stdout=str(so, encoding='utf-8'),
stderr=str(se, encoding='utf=8'),
res = SimpleNamespace(stdout=str(so, encoding='utf-8'),
stderr=str(se, encoding='utf=8'),
returncode=res.returncode)
ru1 = resource.getrusage(resource.RUSAGE_CHILDREN)
......@@ -73,7 +74,30 @@ def run_in_subproc(cmd, env=None, **kwds):
raise ExecutionFailure(cmd, res)
return res, (t1 - t0)
def add_path_to_ld_library_path(path_s, env):
import sys
libpath_var = 'DYLD_LIBRARY_PATH' if sys.platform == 'darwin' else 'LD_LIBRARY_PATH'
env[libpath_var] = "%s:%s" % (path_s, env.get(libpath_var, ""))
def get_cpu_model():
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:]
elif platform.system() == "Darwin":
cmd = "sysctl -n machdep.cpu.brand_string"
return subprocess.check_output(cmd.split())
else:
return "Not supported"
def get_uname():
return subprocess.check_output(["uname", "-a"])
def get_hostname():
return platform.node()
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