Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * fio - the flexible io tester |
| 3 | * |
| 4 | * Copyright (C) 2005 Jens Axboe <axboe@suse.de> |
Jens Axboe | 2e1df07 | 2012-02-09 11:15:02 +0100 | [diff] [blame] | 5 | * Copyright (C) 2006-2012 Jens Axboe <axboe@kernel.dk> |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 6 | * |
Jens Axboe | 8e9fe63 | 2006-10-24 15:11:09 +0200 | [diff] [blame] | 7 | * The license below covers all files distributed with fio unless otherwise |
| 8 | * noted in the file itself. |
| 9 | * |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 10 | * This program is free software; you can redistribute it and/or modify |
Jens Axboe | 8e9fe63 | 2006-10-24 15:11:09 +0200 | [diff] [blame] | 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | */ |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 24 | #include <unistd.h> |
Jens Axboe | dbe1125 | 2007-02-11 00:19:51 +0100 | [diff] [blame] | 25 | #include <locale.h> |
Jens Axboe | a5b01f1 | 2010-11-11 09:19:49 +0100 | [diff] [blame] | 26 | #include <time.h> |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 27 | |
| 28 | #include "fio.h" |
Jens Axboe | 2e5cdb1 | 2008-03-01 18:52:49 +0100 | [diff] [blame] | 29 | #include "smalloc.h" |
Jens Axboe | d529ee1 | 2009-07-01 10:33:03 +0200 | [diff] [blame] | 30 | |
Jens Axboe | 50d1697 | 2011-09-29 17:45:28 -0600 | [diff] [blame] | 31 | int main(int argc, char *argv[], char *envp[]) |
| 32 | { |
Stephen M. Cameron | 480b811 | 2012-02-24 08:17:31 +0100 | [diff] [blame] | 33 | if (initialize_fio(envp)) |
Jens Axboe | 0ad5edc | 2011-10-05 12:39:06 +0200 | [diff] [blame] | 34 | return 1; |
Jens Axboe | 50d1697 | 2011-09-29 17:45:28 -0600 | [diff] [blame] | 35 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 36 | #if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME) |
| 37 | #error "No available clock source!" |
| 38 | #endif |
| 39 | |
Jens Axboe | 50d1697 | 2011-09-29 17:45:28 -0600 | [diff] [blame] | 40 | if (parse_options(argc, argv)) |
| 41 | return 1; |
| 42 | |
Jens Axboe | fa80fea | 2012-12-09 20:29:00 +0100 | [diff] [blame] | 43 | fio_time_init(); |
| 44 | |
Jens Axboe | b9d2f30 | 2012-03-08 20:36:28 +0100 | [diff] [blame] | 45 | if (nr_clients) { |
| 46 | if (fio_start_all_clients()) |
| 47 | return 1; |
Stephen M. Cameron | dd36672 | 2012-02-24 08:17:30 +0100 | [diff] [blame] | 48 | return fio_handle_clients(&fio_client_ops); |
Jens Axboe | b9d2f30 | 2012-03-08 20:36:28 +0100 | [diff] [blame] | 49 | } else |
Jens Axboe | 2e1df07 | 2012-02-09 11:15:02 +0100 | [diff] [blame] | 50 | return fio_backend(); |
Jens Axboe | 50d1697 | 2011-09-29 17:45:28 -0600 | [diff] [blame] | 51 | } |