Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/firecracker
Path: blob/main/tests/host_tools/proc.py
1956 views
1
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
# SPDX-License-Identifier: Apache-2.0
3
"""Utility functions for interacting with the processor."""
4
import re
5
from framework import utils
6
7
8
def proc_type():
9
"""Obtain the model processor on a Linux system."""
10
cmd = "cat /proc/cpuinfo"
11
result = utils.run_cmd(cmd)
12
lines = result.stdout.strip().splitlines()
13
for line in lines:
14
if "model name" in line:
15
return re.sub(".*model name.*:", "", line, 1)
16
17
cmd = "uname -m"
18
result = utils.run_cmd(cmd).stdout.strip()
19
if "aarch64" in result:
20
return "ARM"
21
return ""
22
23