资源简介
FIO是一个开源的I/O压力测试工具,主要是用来测试磁盘/SSD的IO性能,也可测试cpu,nic的IO性能。它可以支持13种不同的I/O引擎,包括:sync, mmap, libaio, posixaio, SG v3, splice, network, syslet, guasi, solarisaio, I/O priorities (针对新的Linux内核), rate I/O, forked or threaded jobs等。
代码片段和文件信息
/*
* fio - the flexible io tester
*
* Copyright (C) 2005 Jens Axboe
* Copyright (C) 2006-2012 Jens Axboe
*
* The license below covers all files distributed with fio unless otherwise
* noted in the file itself.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “fio.h“
#ifndef FIO_NO_HAVE_SHM_H
#include
#endif
#include “hash.h“
#include “smalloc.h“
#include “verify.h“
#include “trim.h“
#include “diskutil.h“
#include “cgroup.h“
#include “profile.h“
#include “lib/rand.h“
#include “lib/memalign.h“
#include “server.h“
#include “lib/getrusage.h“
#include “idletime.h“
#include “err.h“
#include “workqueue.h“
#include “lib/mountcheck.h“
#include “rate-submit.h“
#include “helper_thread.h“
static struct fio_mutex *startup_mutex;
static struct flist_head *cgroup_list;
static char *cgroup_mnt;
static int exit_value;
static volatile int fio_abort;
static unsigned int nr_process = 0;
static unsigned int nr_thread = 0;
struct io_log *agg_io_log[DDIR_RWDIR_CNT];
int groupid = 0;
unsigned int thread_number = 0;
unsigned int stat_number = 0;
int shm_id = 0;
int temp_stall_ts;
unsigned long done_secs = 0;
#define PAGE_ALIGN(buf) \
(char *) (((uintptr_t) (buf) + page_mask) & ~page_mask)
#define JOB_START_TIMEOUT (5 * 1000)
static void sig_int(int sig)
{
if (threads) {
if (is_backend)
fio_server_got_signal(sig);
else {
log_info(“\nfio: terminating on signal %d\n“ sig);
log_info_flush();
exit_value = 128;
}
fio_terminate_threads(TERMINATE_ALL);
}
}
void sig_show_status(int sig)
{
show_running_run_stats();
}
static void set_sig_handlers(void)
{
struct sigaction act;
memset(&act 0 sizeof(act));
act.sa_handler = sig_int;
act.sa_flags = SA_RESTART;
sigaction(SIGINT &act NULL);
memset(&act 0 sizeof(act));
act.sa_handler = sig_int;
act.sa_flags = SA_RESTART;
sigaction(SIGTERM &act NULL);
/* Windows uses SIGBREAK as a quit signal from other applications */
#ifdef WIN32
memset(&act 0 sizeof(act));
act.sa_handler = sig_int;
act.sa_flags = SA_RESTART;
sigac
- 上一篇:手写文字识别开题报告外文翻译
- 下一篇:MSP430F149 最小系统板原理图
评论
共有 条评论