Skip to content

Commit

Permalink
rename some of what gets printed out to match what linux prints in /p…
Browse files Browse the repository at this point in the history
…roc/cpuinfo
  • Loading branch information
graebm committed Jan 28, 2025
1 parent 81d4ea6 commit 5a4318f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bin/system_info/print_system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ int main(void) {
fprintf(stdout, " 'arm_crypto': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_CRYPTO) ? "true" : "false");
fprintf(stdout, " 'amd_sse4_1': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_1) ? "true" : "false");
fprintf(stdout, " 'amd_sse4_2': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_2) ? "true" : "false");
fprintf(stdout, " 'amd_clmul': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_CLMUL) ? "true" : "false");
fprintf(stdout, " 'amd_pclmulqdq': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_CLMUL) ? "true" : "false");
fprintf(stdout, " 'amd_vpclmulqdq': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_VPCLMULQDQ) ? "true" : "false");
fprintf(stdout, " 'amd_avx2': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_AVX2) ? "true" : "false");
fprintf(stdout, " 'amd_avx512': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_AVX512) ? "true" : "false");
fprintf(stdout, " 'amd_avx512f': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_AVX512) ? "true" : "false");
fprintf(stdout, " 'amd_bmi2': %s\n", aws_cpu_has_feature(AWS_CPU_FEATURE_BMI2) ? "true" : "false");
fprintf(stdout, " }\n");

Expand Down
19 changes: 16 additions & 3 deletions bin/system_info/test-print-system-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,29 @@ def main():
else:
app = find_app(args.build_dir)

app_features_yesno: Dict[str, bool] = detect_features_from_app(app)
app_features_presence: Dict[str, bool] = detect_features_from_app(app)

os_features_list = detect_features_from_os()

# TODO: compare app_features_yesno and os_features_list
for (feature, is_present) in app_features_presence.items():
if is_present:
if not feature in os_features_list:
exit(f"FAILED: aws-c-common thinks CPU supports '{feature}', " +
"but OS doesn't seem to think so")
else:
if feature in os_features_list:
exit("FAILED: aws-c-common doesn't think CPU supports '{feature}', " +
"but OS says it does")

print("SUCCESS: aws-c-common and OS agree on CPU features")


def find_app(build_dir: Optional[str]) -> Path:
if build_dir is None:
build_dir = find_build_dir()
else:
build_dir = Path(build_dir)
build_dir = build_dir.absolute()

app_name = 'print-sys-info'
if os.name == 'nt':
Expand All @@ -41,7 +54,7 @@ def find_app(build_dir: Optional[str]) -> Path:
for file in build_dir.glob(f"**/{app_name}"):
return file

exit(f"FAILED: Can't find '{app_name}' under: {build_dir}."
exit(f"FAILED: Can't find '{app_name}' under: {build_dir}"
"\nPass --build-dir to hint location.")


Expand Down

0 comments on commit 5a4318f

Please sign in to comment.