int main(int argc, char *argv[]) { struct pqos_config cfg; const struct pqos_cpuinfo *p_cpu = NULL; const struct pqos_cap *p_cap = NULL; unsigned sock_count, sockets[PQOS_MAX_SOCKETS]; int ret, exit_val = EXIT_SUCCESS; memset(&cfg, 0, sizeof(cfg)); cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; /* PQoS Initialization - Check and initialize CAT and CMT capability */ ret = pqos_init(&cfg); if (ret != PQOS_RETVAL_OK) { printf("Error initializing PQoS library!\n"); exit_val = EXIT_FAILURE; goto error_exit; } /* Get CMT capability and CPU info pointer */ ret = pqos_cap_get(&p_cap, &p_cpu); if (ret != PQOS_RETVAL_OK) { printf("Error retrieving PQoS capabilities!\n"); exit_val = EXIT_FAILURE; goto error_exit; } /* Get CPU socket information to set COS */ ret = pqos_cpu_get_sockets(p_cpu, PQOS_MAX_SOCKETS, &sock_count, sockets); if (ret != PQOS_RETVAL_OK) { printf("Error retrieving CPU socket information!\n"); exit_val = EXIT_FAILURE; goto error_exit; } /* Get input from user */ allocation_get_input(argc, argv); if (sel_l3ca_cos_num != 0) { /* Set bit mask for COS allocation */ ret = set_allocation_class(sock_count, sockets); if (ret < 0) { printf("Allocation configuration error!\n"); goto error_exit; } printf("Allocation configuration altered.\n"); } /* Print COS and associated bit mask */ ret = print_allocation_config(sock_count, sockets); if (ret != PQOS_RETVAL_OK) { printf("Allocation capability not detected!\n"); exit_val = EXIT_FAILURE; goto error_exit; } error_exit: /* reset and deallocate all the resources */ ret = pqos_fini(); if (ret != PQOS_RETVAL_OK) printf("Error shutting down PQoS library!\n"); return exit_val; }
int main(int argc, char *argv[]) { struct pqos_config cfg; const struct pqos_cpuinfo *p_cpu = NULL; const struct pqos_cap *p_cap = NULL; const struct pqos_capability *cap_l3ca = NULL; unsigned sock_count, *sockets = NULL; int ret, exit_val = EXIT_SUCCESS; memset(&cfg, 0, sizeof(cfg)); cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; /* PQoS Initialization - Check and initialize CAT and CMT capability */ ret = pqos_init(&cfg); if (ret != PQOS_RETVAL_OK) { printf("Error initializing PQoS library!\n"); exit_val = EXIT_FAILURE; goto error_exit; } /* Get CMT capability and CPU info pointer */ ret = pqos_cap_get(&p_cap, &p_cpu); if (ret != PQOS_RETVAL_OK) { printf("Error retrieving PQoS capabilities!\n"); exit_val = EXIT_FAILURE; goto error_exit; } if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-H"))) { printf("Usage: %s\n\n", argv[0]); goto error_exit; } /* Reset Api */ ret = pqos_alloc_reset(PQOS_REQUIRE_CDP_ANY, PQOS_REQUIRE_CDP_ANY, PQOS_MBA_ANY); if (ret != PQOS_RETVAL_OK) printf("CAT reset failed!\n"); else printf("CAT reset successful\n"); /* Get CPU socket information to set COS */ sockets = pqos_cpu_get_sockets(p_cpu, &sock_count); if (sockets == NULL) { printf("Error retrieving CPU socket information!\n"); exit_val = EXIT_FAILURE; goto error_exit; } (void) pqos_cap_get_type(p_cap, PQOS_CAP_TYPE_L3CA, &cap_l3ca); /* Print COS and associated cores */ print_allocation_config(cap_l3ca, sock_count, sockets, p_cpu); error_exit: /* reset and deallocate all the resources */ ret = pqos_fini(); if (ret != PQOS_RETVAL_OK) printf("Error shutting down PQoS library!\n"); if (sockets != NULL) free(sockets); return exit_val; }
int main(int argc, char *argv[]) { struct pqos_config cfg; int ret, exit_val = EXIT_SUCCESS; memset(&cfg, 0, sizeof(cfg)); cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; /* PQoS Initialization - Check and initialize CAT and CMT capability */ ret = pqos_init(&cfg); if (ret != PQOS_RETVAL_OK) { printf("Error initializing PQoS library!\n"); exit_val = EXIT_FAILURE; goto error_exit; } /* Get input from user */ enforcement_get_input(argc, argv); if (sel_l3ca_assoc_num) { /* Enforce COS to the associated cores */ ret = set_allocation_assoc(); if (ret < 0) { printf("CAT association error!\n"); goto error_exit; } printf("Allocation configuration altered.\n"); } /* Print COS and associated cores */ print_allocation_config(); error_exit: /* reset and deallocate all the resources */ ret = pqos_fini(); if (ret != PQOS_RETVAL_OK) printf("Error shutting down PQoS library!\n"); return exit_val; }