perftest.c (252267) | perftest.c (253109) |
---|---|
1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sbin/nvmecontrol/perftest.c 252267 2013-06-26 23:02:48Z jimharris $"); | 28__FBSDID("$FreeBSD: head/sbin/nvmecontrol/perftest.c 253109 2013-07-09 21:14:15Z jimharris $"); |
29 30#include <sys/param.h> 31#include <sys/ioccom.h> 32 33#include <ctype.h> | 29 30#include <sys/param.h> 31#include <sys/ioccom.h> 32 33#include <ctype.h> |
34#include <errno.h> | 34#include |
35#include <fcntl.h> 36#include <stdbool.h> 37#include <stddef.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> | 35#include <fcntl.h> 36#include <stdbool.h> 37#include <stddef.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> |
41#include <sysexits.h> | |
42#include <unistd.h> 43 44#include "nvmecontrol.h" 45 46static void 47print_perftest(struct nvme_io_test *io_test, bool perthread) 48{ 49 uint32_t i, io_completed = 0, iops, mbps; --- 17 unchanged lines hidden (view full) --- 67 exit(1); 68} 69 70static void 71perftest_usage(void) 72{ 73 fprintf(stderr, "usage:\n"); 74 fprintf(stderr, PERFTEST_USAGE); | 41#include <unistd.h> 42 43#include "nvmecontrol.h" 44 45static void 46print_perftest(struct nvme_io_test *io_test, bool perthread) 47{ 48 uint32_t i, io_completed = 0, iops, mbps; --- 17 unchanged lines hidden (view full) --- 66 exit(1); 67} 68 69static void 70perftest_usage(void) 71{ 72 fprintf(stderr, "usage:\n"); 73 fprintf(stderr, PERFTEST_USAGE); |
75 exit(EX_USAGE); | 74 exit(1); |
76} 77 78void 79perftest(int argc, char *argv[]) 80{ 81 struct nvme_io_test io_test; 82 int fd; 83 char ch; --- 79 unchanged lines hidden (view full) --- 163 break; 164 } 165 } 166 167 if (!nflag || !oflag || !sflag || !tflag || optind >= argc) 168 perftest_usage(); 169 170 open_dev(argv[optind], &fd, 1, 1); | 75} 76 77void 78perftest(int argc, char *argv[]) 79{ 80 struct nvme_io_test io_test; 81 int fd; 82 char ch; --- 79 unchanged lines hidden (view full) --- 162 break; 163 } 164 } 165 166 if (!nflag || !oflag || !sflag || !tflag || optind >= argc) 167 perftest_usage(); 168 169 open_dev(argv[optind], &fd, 1, 1); |
171 if (ioctl(fd, ioctl_cmd, &io_test) < 0) { 172 fprintf(stderr, "NVME_IO_TEST failed. errno=%d (%s)\n", errno, 173 strerror(errno)); 174 close(fd); 175 exit(EX_IOERR); 176 } | 170 if (ioctl(fd, ioctl_cmd, &io_test) < 0) 171 err(1, "ioctl NVME_IO_TEST failed"); |
177 178 close(fd); 179 print_perftest(&io_test, perthread); | 172 173 close(fd); 174 print_perftest(&io_test, perthread); |
180 exit(EX_OK); | 175 exit(0); |
181} | 176} |