2018-07-07 15:24:59 +03:00
|
|
|
/*
|
|
|
|
* Dummy implementation doesn't do anything besides waiting
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "ior.h"
|
|
|
|
#include "aiori.h"
|
|
|
|
#include "utilities.h"
|
|
|
|
|
2018-07-12 20:09:13 +03:00
|
|
|
|
|
|
|
/************************** O P T I O N S *****************************/
|
|
|
|
struct dummy_options{
|
|
|
|
uint64_t delay_creates;
|
2018-07-14 10:50:27 +03:00
|
|
|
uint64_t delay_xfer;
|
2018-07-12 20:09:13 +03:00
|
|
|
int delay_rank_0_only;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct dummy_options o = {
|
|
|
|
.delay_creates = 0,
|
2018-07-14 10:50:27 +03:00
|
|
|
.delay_xfer = 0,
|
2018-07-12 20:09:13 +03:00
|
|
|
.delay_rank_0_only = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static option_help options [] = {
|
|
|
|
{'c', "delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_creates},
|
2018-07-14 10:50:27 +03:00
|
|
|
{'x', "delay-xfer", "Delay per xfer in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_xfer},
|
2018-07-12 20:09:13 +03:00
|
|
|
{'z', "delay-only-rank0", "Delay only Rank0", OPTION_FLAG, 'd', & o.delay_rank_0_only},
|
|
|
|
LAST_OPTION
|
|
|
|
};
|
|
|
|
|
2018-07-07 22:01:03 +03:00
|
|
|
static char * current = (char*) 1;
|
|
|
|
|
2018-07-12 20:09:13 +03:00
|
|
|
static option_help * DUMMY_options(){
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2018-07-07 15:24:59 +03:00
|
|
|
static void *DUMMY_Create(char *testFileName, IOR_param_t * param)
|
|
|
|
{
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current);
|
|
|
|
}
|
2018-07-12 20:09:13 +03:00
|
|
|
if (o.delay_creates){
|
|
|
|
if (! o.delay_rank_0_only || (o.delay_rank_0_only && rank == 0)){
|
|
|
|
usleep(o.delay_creates);
|
|
|
|
}
|
|
|
|
}
|
2018-07-07 22:01:03 +03:00
|
|
|
return current++;
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *DUMMY_Open(char *testFileName, IOR_param_t * param)
|
|
|
|
{
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY open: %s = %p\n", testFileName, current);
|
|
|
|
}
|
|
|
|
return current++;
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void DUMMY_Fsync(void *fd, IOR_param_t * param)
|
|
|
|
{
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY fsync %p\n", fd);
|
|
|
|
}
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void DUMMY_Close(void *fd, IOR_param_t * param)
|
|
|
|
{
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY close %p\n", fd);
|
|
|
|
}
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void DUMMY_Delete(char *testFileName, IOR_param_t * param)
|
|
|
|
{
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY delete: %s\n", testFileName);
|
|
|
|
}
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
2018-07-14 10:41:35 +03:00
|
|
|
static char * DUMMY_getVersion()
|
2018-07-07 15:24:59 +03:00
|
|
|
{
|
2018-07-14 10:41:35 +03:00
|
|
|
return "0.5";
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static IOR_offset_t DUMMY_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName)
|
2018-07-07 22:01:03 +03:00
|
|
|
{
|
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName);
|
|
|
|
}
|
|
|
|
return 0;
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, IOR_param_t * param){
|
2018-07-07 22:01:03 +03:00
|
|
|
if(verbose > 4){
|
|
|
|
fprintf(out_logfile, "DUMMY xfer: %p\n", file);
|
|
|
|
}
|
2018-07-14 10:50:27 +03:00
|
|
|
if (o.delay_xfer){
|
|
|
|
if (! o.delay_rank_0_only || (o.delay_rank_0_only && rank == 0)){
|
|
|
|
usleep(o.delay_xfer);
|
|
|
|
}
|
2018-07-07 15:24:59 +03:00
|
|
|
}
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
2018-07-07 22:01:03 +03:00
|
|
|
static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, IOR_param_t * param){
|
|
|
|
stat->f_bsize = 1;
|
|
|
|
stat->f_blocks = 1;
|
|
|
|
stat->f_bfree = 1;
|
|
|
|
stat->f_bavail = 1;
|
|
|
|
stat->f_files = 1;
|
|
|
|
stat->f_ffree = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int DUMMY_mkdir (const char *path, mode_t mode, IOR_param_t * param){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int DUMMY_rmdir (const char *path, IOR_param_t * param){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int DUMMY_access (const char *path, int mode, IOR_param_t * param){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){
|
|
|
|
return 0;
|
|
|
|
}
|
2018-07-07 15:24:59 +03:00
|
|
|
|
|
|
|
ior_aiori_t dummy_aiori = {
|
2018-07-07 22:01:03 +03:00
|
|
|
"DUMMY",
|
|
|
|
DUMMY_Create,
|
|
|
|
DUMMY_Open,
|
|
|
|
DUMMY_Xfer,
|
|
|
|
DUMMY_Close,
|
|
|
|
DUMMY_Delete,
|
2018-07-14 10:41:35 +03:00
|
|
|
DUMMY_getVersion,
|
2018-07-07 22:01:03 +03:00
|
|
|
DUMMY_Fsync,
|
|
|
|
DUMMY_GetFileSize,
|
|
|
|
DUMMY_statfs,
|
|
|
|
DUMMY_mkdir,
|
|
|
|
DUMMY_rmdir,
|
|
|
|
DUMMY_access,
|
2018-07-12 20:09:13 +03:00
|
|
|
DUMMY_stat,
|
2018-07-14 11:29:08 +03:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2018-07-12 20:09:13 +03:00
|
|
|
DUMMY_options
|
2018-07-07 15:24:59 +03:00
|
|
|
};
|