Skip to content

Commit

Permalink
add function to get revision value
Browse files Browse the repository at this point in the history
added a new function to get revision value from /proc/cpuinfo file
e.g. '0080' for Power10

Signed-off-by: Disha Goel <[email protected]>
  • Loading branch information
disgoel committed Aug 29, 2023
1 parent a1cd8a8 commit 122d108
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions avocado/utils/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,22 @@ def get_vendor():
return None


def get_revision():
"""
Get revision from /proc/cpuinfo
:return: revision entry from /proc/cpuinfo file
e.g.:- '0080' for IBM POWER10 machine
:rtype: str
"""
rev = None
proc_cpuinfo = genio.read_file("/proc/cpuinfo")
for line in proc_cpuinfo.splitlines():
if 'revision' in line:
rev = (line.split(' ')[3].strip())
return rev


def get_arch():
"""Work out which CPU architecture we're running on."""
cpu_table = [
Expand Down

0 comments on commit 122d108

Please sign in to comment.