static int register_aio_files(int argc, char **argv) { #if HAVE_LIBAIO int i; /* Treat everything after the options as files for AIO */ for (i = g_aio_optind; i < argc; i++) { if (register_aio_file(argv[i]) != 0) { return 1; } } #endif /* HAVE_LIBAIO */ return 0; }
int main(int argc, char **argv) { int rc; rc = parse_args(argc, argv); if (rc != 0) { return rc; } rc = rte_eal_init(sizeof(ealargs) / sizeof(ealargs[0]), ealargs); if (rc < 0) { fprintf(stderr, "could not initialize dpdk\n"); return 1; } g_task = spdk_zmalloc(sizeof(struct perf_task), 0, NULL); if (g_task == NULL) { fprintf(stderr, "g_task alloc failed\n"); exit(1); } g_task->buf = spdk_zmalloc(g_io_size_bytes, 0x1000, NULL); if (g_task->buf == NULL) { fprintf(stderr, "g_task->buf spdk_zmalloc failed\n"); exit(1); } g_tsc_rate = spdk_get_ticks_hz(); #if HAVE_LIBAIO if (g_aio_optind < argc) { printf("Measuring overhead for AIO device %s.\n", argv[g_aio_optind]); if (register_aio_file(argv[g_aio_optind]) != 0) { rc = -1; goto cleanup; } } else #endif { if (register_controllers() != 0) { rc = -1; goto cleanup; } } printf("Initialization complete. Launching workers.\n"); rc = work_fn(); print_stats(); cleanup: free(g_ns); if (g_ctrlr) { spdk_nvme_detach(g_ctrlr->ctrlr); free(g_ctrlr); } if (rc != 0) { fprintf(stderr, "%s: errors occured\n", argv[0]); } return rc; }