功能:完善通用云管工作台、审计与诊断能力
This commit is contained in:
1 parent
5ac692724d
commit
9f05aa20ea
225 files changed
+14266
-141
No files matched your search
@@ -0,0 +1,21 @@
|
||||
"""Sequential single-connection A/B experiment. Always restore normal nice."""
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
import time
|
||||
pid = int(subprocess.check_output(['pgrep', '-x', 'moonlight']))
|
||||
tasks = pathlib.Path('/proc') / str(pid) / 'task'
|
||||
tids = [int(p.name) for p in tasks.iterdir() if (p / 'comm').read_text().strip() == 'PacerRender']
|
||||
assert len(tids) == 1
|
||||
tid = tids[0]
|
||||
results = []
|
||||
try:
|
||||
for label, priority in [('A', 0), ('B', -10)]:
|
||||
assert int(subprocess.check_output(['pgrep', '-x', 'moonlight'])) == pid
|
||||
subprocess.run(['sudo', '-n', 'renice', '-n', str(priority), '-p', str(tid)], check=True, stdout=subprocess.DEVNULL)
|
||||
begin = time.time()
|
||||
data = json.loads(subprocess.check_output(['python3', '/tmp/vdi-response-50.py'], timeout=150))
|
||||
results.append(dict(label=label, nice=priority, started=begin, ended=time.time(), data=data))
|
||||
print(json.dumps(results[-1]), flush=True)
|
||||
finally:
|
||||
subprocess.run(['sudo', '-n', 'renice', '-n', '0', '-p', str(tid)], stdout=subprocess.DEVNULL)
|
||||
Reference in new issue
Block a user