[tools] Make cpu-governor flip more robust in perf runner

NOTRY=true
TBR=mtrofin@chromium.org

Review-Url: https://codereview.chromium.org/1996923002
Cr-Commit-Position: refs/heads/master@{#36399}
This commit is contained in:
machenbach 2016-05-20 02:07:28 -07:00 committed by Commit bot
parent 2f3879d546
commit d77b332e1c

View File

@ -856,8 +856,10 @@ class CustomMachineConfiguration:
try: try:
with open("/sys/devices/system/cpu/present", "r") as f: with open("/sys/devices/system/cpu/present", "r") as f:
indexes = f.readline() indexes = f.readline()
first, last = map(int, indexes.split("-")) r = map(int, indexes.split("-"))
return range(first, last + 1) if len(r) == 1:
return range(r[0], r[0] + 1)
return range(r[0], r[1] + 1)
except Exception as e: except Exception as e:
print "Failed to retrieve number of CPUs." print "Failed to retrieve number of CPUs."
raise e raise e