Commit | Line | Data |
---|---|---|
ebac4655 JA |
1 | /* |
2 | * fio - the flexible io tester | |
3 | * | |
4 | * Copyright (C) 2005 Jens Axboe <axboe@suse.de> | |
2e1df07d | 5 | * Copyright (C) 2006-2012 Jens Axboe <axboe@kernel.dk> |
ebac4655 | 6 | * |
8e9fe637 JA |
7 | * The license below covers all files distributed with fio unless otherwise |
8 | * noted in the file itself. | |
9 | * | |
ebac4655 | 10 | * This program is free software; you can redistribute it and/or modify |
8e9fe637 JA |
11 | * it under the terms of the GNU General Public License version 2 as |
12 | * published by the Free Software Foundation. | |
ebac4655 JA |
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 | */ | |
ebac4655 | 24 | #include <unistd.h> |
dbe1125e | 25 | #include <locale.h> |
a5b01f1b | 26 | #include <time.h> |
ebac4655 JA |
27 | |
28 | #include "fio.h" | |
2e5cdb11 | 29 | #include "smalloc.h" |
d529ee19 | 30 | |
50d16976 JA |
31 | int main(int argc, char *argv[], char *envp[]) |
32 | { | |
af1dc266 JA |
33 | int ret = 1; |
34 | ||
480b8112 | 35 | if (initialize_fio(envp)) |
0ad5edcc | 36 | return 1; |
50d16976 | 37 | |
67bf9823 JA |
38 | #if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME) |
39 | #error "No available clock source!" | |
40 | #endif | |
41 | ||
50d16976 | 42 | if (parse_options(argc, argv)) |
af1dc266 | 43 | goto done; |
50d16976 | 44 | |
18dc4295 KD |
45 | /* |
46 | * line buffer stdout to avoid output lines from multiple | |
47 | * threads getting mixed | |
48 | */ | |
49 | setvbuf(stdout, NULL, _IOLBF, 0); | |
50 | ||
fa80feae JA |
51 | fio_time_init(); |
52 | ||
b9d2f30a | 53 | if (nr_clients) { |
91c0e7c5 JA |
54 | set_genesis_time(); |
55 | ||
b9d2f30a | 56 | if (fio_start_all_clients()) |
af1dc266 JA |
57 | goto done; |
58 | ret = fio_handle_clients(&fio_client_ops); | |
b9d2f30a | 59 | } else |
af1dc266 JA |
60 | ret = fio_backend(); |
61 | ||
62 | done: | |
63 | deinitialize_fio(); | |
64 | return ret; | |
50d16976 | 65 | } |