if (s && !strcmp(s, ": GenuineIntel\n"))
vendor_id = ARCH_INTEL; elseif (s && !strcmp(s, ": AuthenticAMD\n"))
vendor_id = ARCH_AMD;
fclose(inf);
free(res); return vendor_id;
}
int get_vendor(void)
{ staticint vendor = -1;
if (vendor == -1)
vendor = detect_vendor(); if (vendor == 0)
ksft_print_msg("Can not get vendor info...\n");
return vendor;
}
staticvoid cmd_help(void)
{ int i;
printf("usage: resctrl_tests [-h] [-t test list] [-n no_of_bits] [-b benchmark_cmd [option]...]\n");
printf("\t-b benchmark_cmd [option]...: run specified benchmark for MBM, MBA and CMT\n");
printf("\t default benchmark is builtin fill_buf\n");
printf("\t-t test list: run tests/groups specified by the list, ");
printf("e.g. -t mbm,mba,cmt,cat\n");
printf("\t\tSupported tests (group):\n"); for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) { if (resctrl_tests[i]->group)
printf("\t\t\t%s (%s)\n", resctrl_tests[i]->name, resctrl_tests[i]->group); else
printf("\t\t\t%s\n", resctrl_tests[i]->name);
}
printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n");
printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n");
printf("\t-h: help\n");
}
staticint test_prepare(conststruct resctrl_test *test)
{ int res;
res = signal_handler_register(test); if (res) {
ksft_print_msg("Failed to register signal handler\n"); return res;
}
res = mount_resctrlfs(); if (res) {
signal_handler_unregister();
ksft_print_msg("Failed to mount resctrl FS\n"); return res;
} return0;
}
if (!test_vendor_specific_check(test)) {
ksft_test_result_skip("Hardware does not support %s\n", test->name); return;
}
snc_mode = snc_nodes_per_l3_cache();
ksft_print_msg("Starting %s test ...\n", test->name);
if (snc_mode == 1 && snc_unreliable && get_vendor() == ARCH_INTEL) {
ksft_test_result_skip("SNC detection unreliable due to offline CPUs. Test results may not be accurate if SNC enabled.\n"); return;
}
if (test_prepare(test)) {
ksft_exit_fail_msg("Abnormal failure when preparing for the test\n"); return;
}
if (!test->feature_check(test)) {
ksft_test_result_skip("Hardware does not support %s or %s is disabled\n",
test->name, test->name); goto cleanup;
}
ret = test->run_test(test, uparams);
ksft_test_result(!ret, "%s: test\n", test->name);
if (uparams->benchmark_cmd[3] && *uparams->benchmark_cmd[3] != '\0') { if (strcmp(uparams->benchmark_cmd[3], "0")) {
free(fill_param);
ksft_exit_skip("Only read operations supported.\n");
}
}
if (uparams->benchmark_cmd[4] && *uparams->benchmark_cmd[4] != '\0') { if (strcmp(uparams->benchmark_cmd[4], "false")) {
free(fill_param);
ksft_exit_skip("fill_buf is required to run until termination.\n");
}
}
if (!test_param_seen) { for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++)
resctrl_tests[i]->disabled = true;
tests = 0;
test_param_seen = true;
} while (token) { bool found = false;
for (i = 0; i < ARRAY_SIZE(resctrl_tests); i++) { if (!strcasecmp(token, resctrl_tests[i]->name) ||
(resctrl_tests[i]->group &&
!strcasecmp(token, resctrl_tests[i]->group))) { if (resctrl_tests[i]->disabled)
tests++;
resctrl_tests[i]->disabled = false;
found = true;
}
}
if (!found) {
printf("invalid test: %s\n", token);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.