blob: 7e6b06d3793ffe6a0db4a186a263c1b144afb579 [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001/*
2 * fio - the flexible io tester
3 *
4 * Copyright (C) 2005 Jens Axboe <axboe@suse.de>
Jens Axboe2e1df072012-02-09 11:15:02 +01005 * Copyright (C) 2006-2012 Jens Axboe <axboe@kernel.dk>
Jens Axboeebac4652005-12-08 15:25:21 +01006 *
Jens Axboe8e9fe632006-10-24 15:11:09 +02007 * The license below covers all files distributed with fio unless otherwise
8 * noted in the file itself.
9 *
Jens Axboeebac4652005-12-08 15:25:21 +010010 * This program is free software; you can redistribute it and/or modify
Jens Axboe8e9fe632006-10-24 15:11:09 +020011 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
Jens Axboeebac4652005-12-08 15:25:21 +010013 *
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 Axboeebac4652005-12-08 15:25:21 +010024#include <unistd.h>
Jens Axboedbe11252007-02-11 00:19:51 +010025#include <locale.h>
Jens Axboea5b01f12010-11-11 09:19:49 +010026#include <time.h>
Jens Axboeebac4652005-12-08 15:25:21 +010027
28#include "fio.h"
Jens Axboe2e5cdb12008-03-01 18:52:49 +010029#include "smalloc.h"
Jens Axboed529ee12009-07-01 10:33:03 +020030
Jens Axboe50d16972011-09-29 17:45:28 -060031int main(int argc, char *argv[], char *envp[])
32{
Stephen M. Cameron480b8112012-02-24 08:17:31 +010033 if (initialize_fio(envp))
Jens Axboe0ad5edc2011-10-05 12:39:06 +020034 return 1;
Jens Axboe50d16972011-09-29 17:45:28 -060035
Jens Axboe67bf9822013-01-10 11:23:19 +010036#if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME)
37#error "No available clock source!"
38#endif
39
Jens Axboe50d16972011-09-29 17:45:28 -060040 if (parse_options(argc, argv))
41 return 1;
42
Jens Axboefa80fea2012-12-09 20:29:00 +010043 fio_time_init();
44
Jens Axboeb9d2f302012-03-08 20:36:28 +010045 if (nr_clients) {
46 if (fio_start_all_clients())
47 return 1;
Stephen M. Camerondd366722012-02-24 08:17:30 +010048 return fio_handle_clients(&fio_client_ops);
Jens Axboeb9d2f302012-03-08 20:36:28 +010049 } else
Jens Axboe2e1df072012-02-09 11:15:02 +010050 return fio_backend();
Jens Axboe50d16972011-09-29 17:45:28 -060051}