Skip to content

Commit

Permalink
[tools] Upgrade benchmark_tool to Jammy (#18631)
Browse files Browse the repository at this point in the history
Bump the supported Ubuntu version within benchmark_tool to Jammy 22.04.

Also, make the routine for checking installed package versions a bit
more robust. If the package of interest is in a broken state, the
dpkg-query output may not contain a version number at all. The revised
code avoids raising an exception in that case.
  • Loading branch information
rpoyner-tri authored Jan 21, 2023
1 parent a20fb40 commit e201447
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/performance/benchmark_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
If necessary, installs software for CPU speed adjustment. Runs a bazel target,
with CPU speed control disabled. Copies result data to a user selected output
directory. Only supported on Ubuntu 20.04.
directory. Only supported on Ubuntu 22.04.
The purpose of CPU speed control for benchmarking is to disable automatic CPU
speed scaling, so that results of similar experiments will be more repeatable,
Expand All @@ -24,12 +24,12 @@


def is_default_ubuntu():
"""Return True iff platform is Ubuntu 20.04."""
"""Return True iff platform is Ubuntu 22.04."""
if os.uname().sysname != "Linux":
return False
release_info = subprocess.check_output(
["lsb_release", "-irs"], encoding='utf-8')
return ("Ubuntu\n20.04" in release_info)
return ("Ubuntu\n22.04" in release_info)


def get_installed_version(package_name):
Expand All @@ -41,7 +41,10 @@ def get_installed_version(package_name):
encoding='utf-8')
if result.returncode != 0:
return None
status, version = result.stdout.split()
words = result.stdout.split()
if len(words) < 2:
return None
status, version = words[:2]
if status != "ii":
return None
return version
Expand Down

0 comments on commit e201447

Please sign in to comment.