PAPI  5.7.0.0
fileop.c File Reference
Include dependency graph for fileop.c:

Go to the source code of this file.

Data Structures

struct  stat_struct
 

Macros

#define PATH_MAX   255
 
#define _STAT_CREATE   0
 
#define _STAT_WRITE   1
 
#define _STAT_CLOSE   2
 
#define _STAT_LINK   3
 
#define _STAT_UNLINK   4
 
#define _STAT_DELETE   5
 
#define _STAT_STAT   6
 
#define _STAT_ACCESS   7
 
#define _STAT_CHMOD   8
 
#define _STAT_READDIR   9
 
#define _STAT_DIR_CREATE   10
 
#define _STAT_DIR_DELETE   11
 
#define _STAT_READ   12
 
#define _STAT_OPEN   13
 
#define _STAT_DIR_TRAVERSE   14
 
#define _NUM_STATS   15
 
#define THISVERSION   " $Revision$"
 

Functions

static double time_so_far (void)
 
void dir_create (int)
 
void dir_traverse (int)
 
void dir_delete (int)
 
void file_create (int)
 
void file_stat (int)
 
void file_access (int)
 
void file_chmod (int)
 
void file_readdir (int)
 
void file_delete (int)
 
void file_link (int)
 
void file_unlink (int)
 
void file_read (int)
 
void splash (void)
 
void usage (void)
 
void bzero ()
 
void clear_stats ()
 
int validate (char *, int, char)
 
void purge_buffer_cache ()
 
int main (int argc, char **argv)
 

Variables

int junk
 
int * junkp
 
int x
 
int excel
 
int verbose = 0
 
int sz = 1
 
char * mbuffer
 
int incr = 1
 
struct stat_struct stats [_NUM_STATS]
 
char version [] =THISVERSION
 
char thedir [PATH_MAX] ="."
 
const char * mountname =NULL
 
int cret
 
int lower
 
int upper
 
int range
 
int i
 
int best
 
int worst
 
int dirlen
 

Macro Definition Documentation

◆ _NUM_STATS

#define _NUM_STATS   15

Definition at line 98 of file fileop.c.

◆ _STAT_ACCESS

#define _STAT_ACCESS   7

Definition at line 90 of file fileop.c.

◆ _STAT_CHMOD

#define _STAT_CHMOD   8

Definition at line 91 of file fileop.c.

◆ _STAT_CLOSE

#define _STAT_CLOSE   2

Definition at line 85 of file fileop.c.

◆ _STAT_CREATE

#define _STAT_CREATE   0

Definition at line 83 of file fileop.c.

◆ _STAT_DELETE

#define _STAT_DELETE   5

Definition at line 88 of file fileop.c.

◆ _STAT_DIR_CREATE

#define _STAT_DIR_CREATE   10

Definition at line 93 of file fileop.c.

◆ _STAT_DIR_DELETE

#define _STAT_DIR_DELETE   11

Definition at line 94 of file fileop.c.

◆ _STAT_DIR_TRAVERSE

#define _STAT_DIR_TRAVERSE   14

Definition at line 97 of file fileop.c.

◆ _STAT_LINK

#define _STAT_LINK   3

Definition at line 86 of file fileop.c.

◆ _STAT_OPEN

#define _STAT_OPEN   13

Definition at line 96 of file fileop.c.

◆ _STAT_READ

#define _STAT_READ   12

Definition at line 95 of file fileop.c.

◆ _STAT_READDIR

#define _STAT_READDIR   9

Definition at line 92 of file fileop.c.

◆ _STAT_STAT

#define _STAT_STAT   6

Definition at line 89 of file fileop.c.

◆ _STAT_UNLINK

#define _STAT_UNLINK   4

Definition at line 87 of file fileop.c.

◆ _STAT_WRITE

#define _STAT_WRITE   1

Definition at line 84 of file fileop.c.

◆ PATH_MAX

#define PATH_MAX   255

Definition at line 68 of file fileop.c.

◆ THISVERSION

#define THISVERSION   " $Revision$"

Definition at line 131 of file fileop.c.

Function Documentation

◆ bzero()

void bzero ( )
Here is the caller graph for this function:

◆ clear_stats()

void clear_stats ( )

Definition at line 1366 of file fileop.c.

1367 {
1368  int i;
1369  for(i=0;i<_NUM_STATS;i++)
1370  bzero((char *)&stats[i],sizeof(struct stat_struct));
1371 }
void bzero()
struct stat_struct stats[_NUM_STATS]
#define _NUM_STATS
Definition: fileop.c:98
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dir_create()

void dir_create ( int  x)

Definition at line 594 of file fileop.c.

595 {
596  int i,j,k;
597  int ret;
598  char buf[100];
599  stats[_STAT_DIR_CREATE].best=(double)99999.9;
600  stats[_STAT_DIR_CREATE].worst=(double)0.00000000;
601  for(i=0;i<x;i++)
602  {
603  sprintf(buf,"fileop_L1_%d",i);
605  ret=mkdir(buf,0777);
606  if(ret < 0)
607  {
608  printf("Mkdir failed\n");
609  exit(1);
610  }
613  if(stats[_STAT_DIR_CREATE].speed < (double)0.0)
614  stats[_STAT_DIR_CREATE].speed=(double)0.0;
621  junk=chdir(buf);
622  for(j=0;j<x;j++)
623  {
624  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
626  ret=mkdir(buf,0777);
627  if(ret < 0)
628  {
629  printf("Mkdir failed\n");
630  exit(1);
631  }
634  if(stats[_STAT_DIR_CREATE].speed < (double)0.0)
635  stats[_STAT_DIR_CREATE].speed=(double) 0.0;
642  junk=chdir(buf);
643  for(k=0;k<x;k++)
644  {
645  sprintf(buf,"fileop_dir_%d_%d_%d",i,j,k);
647  ret=mkdir(buf,0777);
648  if(ret < 0)
649  {
650  printf("Mkdir failed\n");
651  exit(1);
652  }
655  if(stats[_STAT_DIR_CREATE].speed < (double)0.0)
656  stats[_STAT_DIR_CREATE].speed=(double) 0.0;
663  junk=chdir(buf);
664  junk=chdir("..");
665  }
666  junk=chdir("..");
667  }
668  junk=chdir("..");
669  }
670 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
#define _STAT_DIR_CREATE
Definition: fileop.c:93
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
long long ret
Definition: iozone.c:1346
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dir_delete()

void dir_delete ( int  x)

Definition at line 1099 of file fileop.c.

1100 {
1101  int i,j,k;
1102  char buf[100];
1103  stats[_STAT_DIR_DELETE].best=(double)99999.9;
1104  stats[_STAT_DIR_DELETE].worst=(double)0.00000000;
1105  for(i=0;i<x;i++)
1106  {
1107  sprintf(buf,"fileop_L1_%d",i);
1108  junk=chdir(buf);
1109  for(j=0;j<x;j++)
1110  {
1111  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1112  junk=chdir(buf);
1113  for(k=0;k<x;k++)
1114  {
1115  sprintf(buf,"fileop_dir_%d_%d_%d",i,j,k);
1116  junk=chdir(buf);
1117  junk=chdir("..");
1119  rmdir(buf);
1122  if(stats[_STAT_DIR_DELETE].speed < (double)0.0)
1123  stats[_STAT_DIR_DELETE].speed=(double)0.0;
1130  }
1131  junk=chdir("..");
1132  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1134  rmdir(buf);
1137  if(stats[_STAT_DIR_DELETE].speed < (double)0.0)
1138  stats[_STAT_DIR_DELETE].speed=(double)0.0;
1145  }
1146  junk=chdir("..");
1147  sprintf(buf,"fileop_L1_%d",i);
1149  rmdir(buf);
1152  if(stats[_STAT_DIR_DELETE].speed < (double)0.0)
1153  stats[_STAT_DIR_DELETE].speed=(double)0.0;
1160  }
1161 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
#define _STAT_DIR_DELETE
Definition: fileop.c:94
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dir_traverse()

void dir_traverse ( int  x)

Definition at line 673 of file fileop.c.

674 {
675  int i,j,k;
676  char buf[100];
677  double time1, time2;
678  stats[_STAT_DIR_TRAVERSE].best=(double)99999.9;
679  stats[_STAT_DIR_TRAVERSE].worst=(double)0.00000000;
680  for(i=0;i<x;i++)
681  {
682  sprintf(buf,"fileop_L1_%d",i);
684  junk=chdir(buf);
687  for(j=0;j<x;j++)
688  {
689  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
691  junk=chdir(buf);
694  for(k=0;k<x;k++)
695  {
696  sprintf(buf,"fileop_dir_%d_%d_%d",i,j,k);
698  junk=chdir(buf);
699  junk=chdir("..");
702  if(stats[_STAT_DIR_TRAVERSE].speed < (double)0.0)
703  stats[_STAT_DIR_TRAVERSE].speed=(double) 0.0;
710  }
712  junk=chdir("..");
715  if(stats[_STAT_DIR_TRAVERSE].speed < (double)0.0)
716  stats[_STAT_DIR_TRAVERSE].speed=(double) 0.0;
723  }
725  junk=chdir("..");
728  if(stats[_STAT_DIR_TRAVERSE].speed < (double)0.0)
729  stats[_STAT_DIR_TRAVERSE].speed=(double)0.0;
736  }
737 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
#define _STAT_DIR_TRAVERSE
Definition: fileop.c:97
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_access()

void file_access ( int  x)

Definition at line 873 of file fileop.c.

874 {
875  int i,j,k,y;
876  char buf[100];
877  stats[_STAT_ACCESS].best=(double)999999.9;
878  stats[_STAT_ACCESS].worst=(double)0.0;
879  for(i=0;i<x;i++)
880  {
881  sprintf(buf,"fileop_L1_%d",i);
882  junk=chdir(buf);
883  for(j=0;j<x;j++)
884  {
885  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
886  junk=chdir(buf);
887  for(k=0;k<x;k++)
888  {
889  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
891  y=access(buf,W_OK|F_OK);
892  if(y < 0)
893  {
894  printf("access failed\n");
895  perror("what");
896  exit(1);
897  }
900  if(stats[_STAT_ACCESS].speed < (double)0.0)
901  stats[_STAT_ACCESS].speed=(double)0.0;
908  }
909  junk=chdir("..");
910  }
911  junk=chdir("..");
912  }
913 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
#define _STAT_ACCESS
Definition: fileop.c:90
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_chmod()

void file_chmod ( int  x)

Definition at line 916 of file fileop.c.

917 {
918  int i,j,k,y;
919  char buf[100];
920  stats[_STAT_CHMOD].best=(double)999999.9;
921  stats[_STAT_CHMOD].worst=(double)0.0;
922  for(i=0;i<x;i++)
923  {
924  sprintf(buf,"fileop_L1_%d",i);
925  junk=chdir(buf);
926  for(j=0;j<x;j++)
927  {
928  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
929  junk=chdir(buf);
930  for(k=0;k<x;k++)
931  {
932  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
934  y=chmod(buf,0666);
935  if(y < 0)
936  {
937  printf("chmod failed\n");
938  perror("what");
939  exit(1);
940  }
943  if(stats[_STAT_CHMOD].speed < (double)0.0)
944  stats[_STAT_CHMOD].speed=(double)0.0;
947  if(stats[_STAT_CHMOD].speed < stats[_STAT_CHMOD].best)
949  if(stats[_STAT_CHMOD].speed > stats[_STAT_CHMOD].worst)
951  }
952  junk=chdir("..");
953  }
954  junk=chdir("..");
955  }
956 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
#define _STAT_CHMOD
Definition: fileop.c:91
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_create()

void file_create ( int  x)

Definition at line 740 of file fileop.c.

741 {
742  int i,j,k;
743  int fd;
744  int ret;
745  char buf[100];
746  char value;
747  stats[_STAT_CREATE].best=(double)999999.9;
748  stats[_STAT_CREATE].worst=(double)0.0;
749  stats[_STAT_WRITE].best=(double)999999.9;
750  stats[_STAT_WRITE].worst=(double)0.0;
751  stats[_STAT_CLOSE].best=(double)999999.9;
752  stats[_STAT_CLOSE].worst=(double)0.0;
753  for(i=0;i<x;i++)
754  {
755  sprintf(buf,"fileop_L1_%d",i);
756  ret=mkdir(buf,0777);
757  if(ret < 0)
758  {
759  printf("Mkdir failed\n");
760  exit(1);
761  }
762  junk=chdir(buf);
763  for(j=0;j<x;j++)
764  {
765  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
766  ret=mkdir(buf,0777);
767  if(ret < 0)
768  {
769  printf("Mkdir failed\n");
770  exit(1);
771  }
772  junk=chdir(buf);
773  for(k=0;k<x;k++)
774  {
775  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
776  value=(char) ((i^j^k) & 0xff);
777  memset(mbuffer,value,sz);
779  fd=creat(buf,O_RDWR|0600);
780  if(fd < 0)
781  {
782  printf("Create failed\n");
783  exit(1);
784  }
787  if(stats[_STAT_CREATE].speed < (double)0.0)
788  stats[_STAT_CREATE].speed=(double)0.0;
795 
801  if(stats[_STAT_WRITE].speed < (double)0.0)
802  stats[_STAT_WRITE].speed=(double)0.0;
804  if(stats[_STAT_WRITE].speed < stats[_STAT_WRITE].best)
806  if(stats[_STAT_WRITE].speed > stats[_STAT_WRITE].worst)
808 
809  fsync(fd);
811  close(fd);
814  if(stats[_STAT_CLOSE].speed < (double)0.0)
815  stats[_STAT_CLOSE].speed=(double)0.0;
818  if(stats[_STAT_CLOSE].speed < stats[_STAT_CLOSE].best)
820  if(stats[_STAT_CLOSE].speed > stats[_STAT_CLOSE].worst)
822  }
823  junk=chdir("..");
824  }
825  junk=chdir("..");
826  }
827 }
long long counter
Definition: fileop.c:108
int close(int fd)
Definition: appio.c:175
int junk
Definition: fileop.c:77
int fd
Definition: iozone.c:1291
double worst
Definition: fileop.c:104
#define _STAT_CLOSE
Definition: fileop.c:85
struct stat_struct stats[_NUM_STATS]
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
char * mbuffer
Definition: fileop.c:81
double total_time
Definition: fileop.c:106
long long ret
Definition: iozone.c:1346
#define _STAT_CREATE
Definition: fileop.c:83
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
#define _STAT_WRITE
Definition: fileop.c:84
int fsync()
int i
Definition: fileop.c:140
int sz
Definition: fileop.c:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_delete()

void file_delete ( int  x)

Definition at line 1164 of file fileop.c.

1165 {
1166  int i,j,k;
1167  char buf[100];
1168  stats[_STAT_DELETE].best=(double)999999.9;
1169  stats[_STAT_DELETE].worst=(double)0.0;
1170  for(i=0;i<x;i++)
1171  {
1172  sprintf(buf,"fileop_L1_%d",i);
1173  junk=chdir(buf);
1174  for(j=0;j<x;j++)
1175  {
1176  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1177  junk=chdir(buf);
1178  for(k=0;k<x;k++)
1179  {
1180  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
1182  unlink(buf);
1185  if(stats[_STAT_DELETE].speed < (double)0.0)
1186  stats[_STAT_DELETE].speed=(double)0.0;
1189  if(stats[_STAT_DELETE].speed < stats[_STAT_DELETE].best)
1191  if(stats[_STAT_DELETE].speed > stats[_STAT_DELETE].worst)
1193  }
1194  junk=chdir("..");
1195  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1196  rmdir(buf);
1197  }
1198  junk=chdir("..");
1199  sprintf(buf,"fileop_L1_%d",i);
1200  rmdir(buf);
1201  }
1202 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
#define _STAT_DELETE
Definition: fileop.c:88
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
int unlink()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_link()

void file_link ( int  x)

Definition at line 1011 of file fileop.c.

1012 {
1013  int i,j,k,y;
1014  char buf[100];
1015  char bufn[100];
1016  stats[_STAT_LINK].best=(double)999999.9;
1017  stats[_STAT_LINK].worst=(double)0.0;
1018  for(i=0;i<x;i++)
1019  {
1020  sprintf(buf,"fileop_L1_%d",i);
1021  junk=chdir(buf);
1022  for(j=0;j<x;j++)
1023  {
1024  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1025  junk=chdir(buf);
1026  for(k=0;k<x;k++)
1027  {
1028  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
1029  sprintf(bufn,"fileop_file_%d_%d_%dL",i,j,k);
1031  y=link(buf,bufn);
1032  if(y < 0)
1033  {
1034  printf("Link failed\n");
1035  exit(1);
1036  }
1039  if(stats[_STAT_LINK].speed < (double)0.0)
1040  stats[_STAT_LINK].speed=(double)0.0;
1043  if(stats[_STAT_LINK].speed < stats[_STAT_LINK].best)
1045  if(stats[_STAT_LINK].speed > stats[_STAT_LINK].worst)
1047  }
1048  junk=chdir("..");
1049  }
1050  junk=chdir("..");
1051  }
1052 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
#define _STAT_LINK
Definition: fileop.c:86
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_read()

void file_read ( int  x)

Definition at line 1204 of file fileop.c.

1205 {
1206  int i,j,k,y,fd;
1207  char buf[100];
1208  char value;
1209  stats[_STAT_READ].best=(double)99999.9;
1210  stats[_STAT_READ].worst=(double)0.00000000;
1211  stats[_STAT_OPEN].best=(double)99999.9;
1212  stats[_STAT_OPEN].worst=(double)0.00000000;
1213  for(i=0;i<x;i++)
1214  {
1215  sprintf(buf,"fileop_L1_%d",i);
1216  junk=chdir(buf);
1217  for(j=0;j<x;j++)
1218  {
1219  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1220  junk=chdir(buf);
1221  for(k=0;k<x;k++)
1222  {
1223  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
1224  value=(char)((i^j^k) &0xff);
1226  fd=open(buf,O_RDONLY);
1227  if(fd < 0)
1228  {
1229  printf("Open failed\n");
1230  exit(1);
1231  }
1234  if(stats[_STAT_OPEN].speed < (double)0.0)
1235  stats[_STAT_OPEN].speed=(double)0.0;
1238  if(stats[_STAT_OPEN].speed < stats[_STAT_OPEN].best)
1240  if(stats[_STAT_OPEN].speed > stats[_STAT_OPEN].worst)
1242 
1244  y=read(fd,mbuffer,sz);
1245  if(y < 0)
1246  {
1247  printf("Read failed\n");
1248  exit(1);
1249  }
1250  if(validate(mbuffer,sz, value) !=0)
1251  printf("Error: Data Mis-compare\n");;
1253  close(fd);
1255  if(stats[_STAT_READ].speed < (double)0.0)
1256  stats[_STAT_READ].speed=(double)0.0;
1259  if(stats[_STAT_READ].speed < stats[_STAT_READ].best)
1261  if(stats[_STAT_READ].speed > stats[_STAT_READ].worst)
1263  }
1264  junk=chdir("..");
1265  }
1266  junk=chdir("..");
1267  }
1268 }
long long counter
Definition: fileop.c:108
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
#define _STAT_OPEN
Definition: fileop.c:96
int close(int fd)
Definition: appio.c:175
int junk
Definition: fileop.c:77
int fd
Definition: iozone.c:1291
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:184
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
int validate(char *, int, char)
Definition: fileop.c:1373
char * mbuffer
Definition: fileop.c:81
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
#define _STAT_READ
Definition: fileop.c:95
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
int sz
Definition: fileop.c:80
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_readdir()

void file_readdir ( int  x)

Definition at line 959 of file fileop.c.

960 {
961  int i,j,ret1;
962  char buf[100];
963  DIR *dirbuf;
964  struct dirent *y;
965  stats[_STAT_READDIR].best=(double)999999.9;
966  stats[_STAT_READDIR].worst=(double)0.0;
967  for(i=0;i<x;i++)
968  {
969  sprintf(buf,"fileop_L1_%d",i);
970  junk=chdir(buf);
971  for(j=0;j<x;j++)
972  {
973  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
974  junk=chdir(buf);
975  dirbuf=opendir(".");
976  if(dirbuf==0)
977  {
978  printf("opendir failed\n");
979  exit(1);
980  }
982  y=readdir(dirbuf);
983  if(y == 0)
984  {
985  printf("readdir failed\n");
986  exit(1);
987  }
990  if(stats[_STAT_READDIR].speed < (double)0.0)
991  stats[_STAT_READDIR].speed=(double)0.0;
998  ret1=closedir(dirbuf);
999  if(ret1 < 0)
1000  {
1001  printf("closedir failed\n");
1002  exit(1);
1003  }
1004  junk=chdir("..");
1005  }
1006  junk=chdir("..");
1007  }
1008 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
#define _STAT_READDIR
Definition: fileop.c:92
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_stat()

void file_stat ( int  x)

Definition at line 830 of file fileop.c.

831 {
832  int i,j,k,y;
833  char buf[100];
834  struct stat mystat;
835  stats[_STAT_STAT].best=(double)99999.9;
836  stats[_STAT_STAT].worst=(double)0.00000000;
837  for(i=0;i<x;i++)
838  {
839  sprintf(buf,"fileop_L1_%d",i);
840  junk=chdir(buf);
841  for(j=0;j<x;j++)
842  {
843  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
844  junk=chdir(buf);
845  for(k=0;k<x;k++)
846  {
847  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
849  y=stat(buf,&mystat);
850  if(y < 0)
851  {
852  printf("Stat failed\n");
853  exit(1);
854  }
857  if(stats[_STAT_STAT].speed < (double)0.0)
858  stats[_STAT_STAT].speed=(double)0.0;
861  if(stats[_STAT_STAT].speed < stats[_STAT_STAT].best)
863  if(stats[_STAT_STAT].speed > stats[_STAT_STAT].worst)
865  }
866  junk=chdir("..");
867  }
868  junk=chdir("..");
869  }
870 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
#define _STAT_STAT
Definition: fileop.c:89
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_unlink()

void file_unlink ( int  x)

Definition at line 1055 of file fileop.c.

1056 {
1057  int i,j,k,y;
1058  char buf[100];
1059  char bufn[100];
1060  stats[_STAT_UNLINK].best=(double)999999.9;
1061  stats[_STAT_UNLINK].worst=(double)0.0;
1062  for(i=0;i<x;i++)
1063  {
1064  sprintf(buf,"fileop_L1_%d",i);
1065  junk=chdir(buf);
1066  for(j=0;j<x;j++)
1067  {
1068  sprintf(buf,"fileop_L1_%d_L2_%d",i,j);
1069  junk=chdir(buf);
1070  for(k=0;k<x;k++)
1071  {
1072  sprintf(buf,"fileop_file_%d_%d_%d",i,j,k);
1073  sprintf(bufn,"fileop_file_%d_%d_%dL",i,j,k);
1075  y=unlink(bufn);
1076  if(y < 0)
1077  {
1078  printf("Unlink failed\n");
1079  exit(1);
1080  }
1083  if(stats[_STAT_UNLINK].speed < (double)0.0)
1084  stats[_STAT_UNLINK].speed=(double)0.0;
1087  if(stats[_STAT_UNLINK].speed < stats[_STAT_UNLINK].best)
1089  if(stats[_STAT_UNLINK].speed > stats[_STAT_UNLINK].worst)
1091  }
1092  junk=chdir("..");
1093  }
1094  junk=chdir("..");
1095  }
1096 }
long long counter
Definition: fileop.c:108
int junk
Definition: fileop.c:77
double worst
Definition: fileop.c:104
struct stat_struct stats[_NUM_STATS]
#define _STAT_UNLINK
Definition: fileop.c:87
int best
Definition: fileop.c:141
double endtime
Definition: fileop.c:101
double total_time
Definition: fileop.c:106
double best
Definition: fileop.c:103
double starttime
Definition: fileop.c:100
int x
Definition: fileop.c:78
double speed
Definition: fileop.c:102
int worst
Definition: fileop.c:141
static double time_so_far(void)
Definition: fileop.c:1279
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
int unlink()
void exit()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 176 of file fileop.c.

177 {
178  if(argc == 1)
179  {
180  usage();
181  exit(1);
182  }
183  while((cret = getopt(argc,argv,"hbwetvf:s:l:u:d:U:i: ")) != EOF){
184  switch(cret){
185  case 'h':
186  usage();
187  exit(0);
188  break;
189  case 'd' :
190  dirlen=strlen(optarg);
191  if (optarg[dirlen-1]=='/')
192  --dirlen;
193  strncpy(thedir, optarg, dirlen);
194  thedir[dirlen] = 0;
195  break;
196  case 'U':
197  mountname = optarg;
198  break;
199  case 'i': /* Increment force by */
200  incr=atoi(optarg);
201  if(incr < 0)
202  incr=1;
203  break;
204  case 'f': /* Force factor */
205  x=atoi(optarg);
206  if(x < 0)
207  x=1;
208  break;
209  case 's': /* Size of files */
210  sz=atoi(optarg);
211  if(optarg[strlen(optarg)-1]=='k' ||
212  optarg[strlen(optarg)-1]=='K'){
213  sz = (1024 * atoi(optarg));
214  }
215  if(optarg[strlen(optarg)-1]=='m' ||
216  optarg[strlen(optarg)-1]=='M'){
217  sz = (1024 * 1024 * atoi(optarg));
218  }
219  if(sz < 0)
220  sz=1;
221  break;
222  case 'l': /* lower force value */
223  lower=atoi(optarg);
224  range=1;
225  if(lower < 0)
226  lower=1;
227  break;
228  case 'v': /* version */
229  splash();
230  exit(0);
231  break;
232  case 'u': /* upper force value */
233  upper=atoi(optarg);
234  range=1;
235  if(upper < 0)
236  upper=1;
237  break;
238  case 't': /* verbose */
239  verbose=1;
240  break;
241  case 'e': /* Excel */
242  excel=1;
243  break;
244  case 'b': /* Best */
245  best=1;
246  break;
247  case 'w': /* Worst */
248  worst=1;
249  break;
250  }
251  }
252  mbuffer=(char *)malloc(sz);
253  memset(mbuffer,'a',sz);
254  if(!excel)
255  printf("\nFileop: Working in %s, File size is %d, Output is in Ops/sec. (A=Avg, B=Best, W=Worst)\n", thedir, sz);
256  if(!verbose)
257  {
258 #ifdef Windows
259  printf(" . %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %10s\n",
260  "mkdir","chdir","rmdir","create","open","read","write","close","stat",
261  "access","chmod","readdir","delete"," Total_files");
262 #else
263 
264  printf(" . %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %7s %10s\n",
265  "mkdir","chdir","rmdir","create","open", "read","write","close","stat",
266  "access","chmod","readdir","link ","unlink","delete",
267  " Total_files");
268 #endif
269  }
270  junk=chdir(thedir); /* change starting point */
271  if(x==0)
272  x=1;
273  if(range==0)
274  lower=upper=x;
275  for(i=lower;i<=upper;i+=incr)
276  {
277  clear_stats();
278  x=i;
279  /*
280  * Dir Create test
281  */
283  dir_create(x);
284 
285  if(verbose)
286  {
287  printf("mkdir: Dirs = %9lld ",stats[_STAT_DIR_CREATE].counter);
288  printf("Total Time = %12.9f seconds\n", stats[_STAT_DIR_CREATE].total_time);
289  printf(" Avg mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n",
292  printf(" Best mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n",1/stats[_STAT_DIR_CREATE].best,stats[_STAT_DIR_CREATE].best);
293  printf(" Worst mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",1/stats[_STAT_DIR_CREATE].worst,stats[_STAT_DIR_CREATE].worst);
294  }
295 
296  /*
297  * Dir Traverse test
298  */
300  dir_traverse(x);
301 
302  if(verbose)
303  {
304  printf("chdir: Dirs = %9lld ",stats[_STAT_DIR_TRAVERSE].counter);
305  printf("Total Time = %12.9f seconds\n", stats[_STAT_DIR_TRAVERSE].total_time);
306  printf(" Avg chdir(s)/sec = %12.2f (%12.9f seconds/op)\n",
309  printf(" Best chdir(s)/sec = %12.2f (%12.9f seconds/op)\n",1/stats[_STAT_DIR_TRAVERSE].best,stats[_STAT_DIR_TRAVERSE].best);
310  printf(" Worst chdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",1/stats[_STAT_DIR_TRAVERSE].worst,stats[_STAT_DIR_TRAVERSE].worst);
311  }
312 
313  /*
314  * Dir delete test
315  */
317  dir_delete(x);
318 
319  if(verbose)
320  {
321  printf("rmdir: Dirs = %9lld ",stats[_STAT_DIR_DELETE].counter);
322  printf("Total Time = %12.9f seconds\n",stats[_STAT_DIR_DELETE].total_time);
323  printf(" Avg rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n",
326  printf(" Best rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n",1/stats[_STAT_DIR_DELETE].best,stats[_STAT_DIR_DELETE].best);
327  printf(" Worst rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",1/stats[_STAT_DIR_DELETE].worst,stats[_STAT_DIR_DELETE].worst);
328  }
329 
330  /*
331  * Create test
332  */
334  file_create(x);
335  if(verbose)
336  {
337  printf("create: Files = %9lld ",stats[_STAT_CREATE].counter);
338  printf("Total Time = %12.9f seconds\n", stats[_STAT_CREATE].total_time);
339  printf(" Avg create(s)/sec = %12.2f (%12.9f seconds/op)\n",
342  printf(" Best create(s)/sec = %12.2f (%12.9f seconds/op)\n",
344  printf(" Worst create(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
346  printf("write: Files = %9lld ",stats[_STAT_WRITE].counter);
347  printf("Total Time = %12.9f seconds\n", stats[_STAT_WRITE].total_time);
348  printf(" Avg write(s)/sec = %12.2f (%12.9f seconds/op)\n",
351  printf(" Best write(s)/sec = %12.2f (%12.9f seconds/op)\n",
353  printf(" Worst write(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
355  printf("close: Files = %9lld ",stats[_STAT_CLOSE].counter);
356  printf("Total Time = %12.9f seconds\n", stats[_STAT_CLOSE].total_time);
357  printf(" Avg close(s)/sec = %12.2f (%12.9f seconds/op)\n",
360  printf(" Best close(s)/sec = %12.2f (%12.9f seconds/op)\n",
362  printf(" Worst close(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
364  }
365 
366  /*
367  * Stat test
368  */
370  file_stat(x);
371 
372  if(verbose)
373  {
374  printf("stat: Files = %9lld ",stats[_STAT_STAT].counter);
375  printf("Total Time = %12.9f seconds\n", stats[_STAT_STAT].total_time);
376  printf(" Avg stat(s)/sec = %12.2f (%12.9f seconds/op)\n",
379  printf(" Best stat(s)/sec = %12.2f (%12.9f seconds/op)\n",
381  printf(" Worst stat(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
383  }
384  /*
385  * Read test
386  */
388  file_read(x);
389 
390  if(verbose)
391  {
392  printf("open: Files = %9lld ",stats[_STAT_OPEN].counter);
393  printf("Total Time = %12.9f seconds\n", stats[_STAT_OPEN].total_time);
394  printf(" Avg open(s)/sec = %12.2f (%12.9f seconds/op)\n",
397  printf(" Best open(s)/sec = %12.2f (%12.9f seconds/op)\n",
399  printf(" Worst open(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
401 
402  printf("read: Files = %9lld ",stats[_STAT_READ].counter);
403  printf("Total Time = %12.9f seconds\n", stats[_STAT_READ].total_time);
404  printf(" Avg read(s)/sec = %12.2f (%12.9f seconds/op)\n",
407  printf(" Best read(s)/sec = %12.2f (%12.9f seconds/op)\n",
409  printf(" Worst read(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
411  }
412 
413  /*
414  * Access test
415  */
417  file_access(x);
418  if(verbose)
419  {
420  printf("access: Files = %9lld ",stats[_STAT_ACCESS].counter);
421  printf("Total Time = %12.9f seconds\n", stats[_STAT_ACCESS].total_time);
422  printf(" Avg access(s)/sec = %12.2f (%12.9f seconds/op)\n",
425  printf(" Best access(s)/sec = %12.2f (%12.9f seconds/op)\n",
427  printf(" Worst access(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
429  }
430  /*
431  * Chmod test
432  */
434  file_chmod(x);
435 
436  if(verbose)
437  {
438  printf("chmod: Files = %9lld ",stats[_STAT_CHMOD].counter);
439  printf("Total Time = %12.9f seconds\n", stats[_STAT_CHMOD].total_time);
440  printf(" Avg chmod(s)/sec = %12.2f (%12.9f seconds/op)\n",
443  printf(" Best chmod(s)/sec = %12.2f (%12.9f seconds/op)\n",
445  printf(" Worst chmod(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
447  }
448  /*
449  * readdir test
450  */
452  file_readdir(x);
453 
454  if(verbose)
455  {
456  printf("readdir: Files = %9lld ",stats[_STAT_READDIR].counter);
457  printf("Total Time = %12.9f seconds\n", stats[_STAT_READDIR].total_time);
458  printf(" Avg readdir(s)/sec = %12.2f (%12.9f seconds/op)\n",
461  printf(" Best readdir(s)/sec = %12.2f (%12.9f seconds/op)\n",
463  printf(" Worst readdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
465  }
466 #if !defined(Windows)
467  /*
468  * link test
469  */
471  file_link(x);
472  if(verbose)
473  {
474  printf("link: Files = %9lld ",stats[_STAT_LINK].counter);
475  printf("Total Time = %12.9f seconds\n",stats[_STAT_LINK].total_time);
476  printf(" Avg link(s)/sec = %12.2f (%12.9f seconds/op)\n",
479  printf(" Best link(s)/sec = %12.2f (%12.9f seconds/op)\n",
481  printf(" Worst link(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
483  }
484  /*
485  * unlink test
486  */
488  file_unlink(x);
489  if(verbose)
490  {
491  printf("unlink: Files = %9lld ",stats[_STAT_UNLINK].counter);
492  printf("Total Time = %12.9f seconds\n", stats[_STAT_UNLINK].total_time);
493  printf(" Avg unlink(s)/sec = %12.2f (%12.9f seconds/op)\n",
496  printf(" Best unlink(s)/sec = %12.2f (%12.9f seconds/op)\n",
498  printf(" Worst unlink(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
500  }
501 #endif
502  /*
503  * Delete test
504  */
506  file_delete(x);
507  if(verbose)
508  {
509  printf("delete: Files = %9lld ",stats[_STAT_DELETE].counter);
510  printf("Total Time = %12.9f seconds\n", stats[_STAT_DELETE].total_time);
511  printf(" Avg delete(s)/sec = %12.2f (%12.9f seconds/op)\n",
514  printf(" Best delete(s)/sec = %12.2f (%12.9f seconds/op)\n",
516  printf(" Worst delete(s)/sec = %12.2f (%12.9f seconds/op)\n\n",
518  }
519  if(!verbose)
520  {
521  printf("%c %4d %7.0f ",'A',x,stats[_STAT_DIR_CREATE].counter/stats[_STAT_DIR_CREATE].total_time);
522  printf("%7.0f ",stats[_STAT_DIR_TRAVERSE].counter/stats[_STAT_DIR_TRAVERSE].total_time);
523  printf("%7.0f ",stats[_STAT_DIR_DELETE].counter/stats[_STAT_DIR_DELETE].total_time);
524  printf("%7.0f ",stats[_STAT_CREATE].counter/stats[_STAT_CREATE].total_time);
525  printf("%7.0f ",stats[_STAT_OPEN].counter/stats[_STAT_OPEN].total_time);
526  printf("%7.0f ",stats[_STAT_READ].counter/stats[_STAT_READ].total_time);
527  printf("%7.0f ",stats[_STAT_WRITE].counter/stats[_STAT_WRITE].total_time);
528  printf("%7.0f ",stats[_STAT_CLOSE].counter/stats[_STAT_CLOSE].total_time);
529  printf("%7.0f ",stats[_STAT_STAT].counter/stats[_STAT_STAT].total_time);
530  printf("%7.0f ",stats[_STAT_ACCESS].counter/stats[_STAT_ACCESS].total_time);
531  printf("%7.0f ",stats[_STAT_CHMOD].counter/stats[_STAT_CHMOD].total_time);
532  printf("%7.0f ",stats[_STAT_READDIR].counter/stats[_STAT_READDIR].total_time);
533 #ifndef Windows
534  printf("%7.0f ",stats[_STAT_LINK].counter/stats[_STAT_LINK].total_time);
535  printf("%7.0f ",stats[_STAT_UNLINK].counter/stats[_STAT_UNLINK].total_time);
536 #endif
537  printf("%7.0f ",stats[_STAT_DELETE].counter/stats[_STAT_DELETE].total_time);
538  printf("%10d ",x*x*x);
539  printf("\n");
540  fflush(stdout);
541 
542  if(best)
543  {
544  printf("%c %4d %7.0f ",'B',x, 1/stats[_STAT_DIR_CREATE].best);
545  printf("%7.0f ",1/stats[_STAT_DIR_TRAVERSE].best);
546  printf("%7.0f ",1/stats[_STAT_DIR_DELETE].best);
547  printf("%7.0f ",1/stats[_STAT_CREATE].best);
548  printf("%7.0f ",1/stats[_STAT_OPEN].best);
549  printf("%7.0f ",1/stats[_STAT_READ].best);
550  printf("%7.0f ",1/stats[_STAT_WRITE].best);
551  printf("%7.0f ",1/stats[_STAT_CLOSE].best);
552  printf("%7.0f ",1/stats[_STAT_STAT].best);
553  printf("%7.0f ",1/stats[_STAT_ACCESS].best);
554  printf("%7.0f ",1/stats[_STAT_CHMOD].best);
555  printf("%7.0f ",1/stats[_STAT_READDIR].best);
556 #ifndef Windows
557  printf("%7.0f ",1/stats[_STAT_LINK].best);
558  printf("%7.0f ",1/stats[_STAT_UNLINK].best);
559 #endif
560  printf("%7.0f ",1/stats[_STAT_DELETE].best);
561  printf("%10d ",x*x*x);
562  printf("\n");
563  fflush(stdout);
564  }
565  if(worst)
566  {
567  printf("%c %4d %7.0f ",'W',x, 1/stats[_STAT_DIR_CREATE].worst);
568  printf("%7.0f ",1/stats[_STAT_DIR_TRAVERSE].worst);
569  printf("%7.0f ",1/stats[_STAT_DIR_DELETE].worst);
570  printf("%7.0f ",1/stats[_STAT_CREATE].worst);
571  printf("%7.0f ",1/stats[_STAT_OPEN].worst);
572  printf("%7.0f ",1/stats[_STAT_READ].worst);
573  printf("%7.0f ",1/stats[_STAT_WRITE].worst);
574  printf("%7.0f ",1/stats[_STAT_CLOSE].worst);
575  printf("%7.0f ",1/stats[_STAT_STAT].worst);
576  printf("%7.0f ",1/stats[_STAT_ACCESS].worst);
577  printf("%7.0f ",1/stats[_STAT_CHMOD].worst);
578  printf("%7.0f ",1/stats[_STAT_READDIR].worst);
579 #ifndef Windows
580  printf("%7.0f ",1/stats[_STAT_LINK].worst);
581  printf("%7.0f ",1/stats[_STAT_UNLINK].worst);
582 #endif
583  printf("%7.0f ",1/stats[_STAT_DELETE].worst);
584  printf("%10d ",x*x*x);
585  printf("\n");
586  fflush(stdout);
587  }
588  }
589  }
590  return(0);
591 }
const char * mountname
Definition: fileop.c:136
int atoi()
#define _STAT_OPEN
Definition: fileop.c:96
int junk
Definition: fileop.c:77
#define _STAT_DIR_TRAVERSE
Definition: fileop.c:97
int verbose
Definition: fileop.c:79
void file_delete(int)
Definition: fileop.c:1164
void clear_stats()
Definition: fileop.c:1366
void dir_delete(int)
Definition: fileop.c:1099
void file_readdir(int)
Definition: fileop.c:959
int incr
Definition: fileop.c:82
#define _STAT_DELETE
Definition: fileop.c:88
#define _STAT_CLOSE
Definition: fileop.c:85
#define _STAT_DIR_CREATE
Definition: fileop.c:93
struct stat_struct stats[_NUM_STATS]
void file_link(int)
Definition: fileop.c:1011
int lower
Definition: fileop.c:139
void file_access(int)
Definition: fileop.c:873
#define _STAT_STAT
Definition: fileop.c:89
int upper
Definition: fileop.c:139
char thedir[PATH_MAX]
Definition: fileop.c:135
#define _STAT_UNLINK
Definition: fileop.c:87
int best
Definition: fileop.c:141
#define _STAT_ACCESS
Definition: fileop.c:90
void usage(void)
Definition: fileop.c:1330
void file_chmod(int)
Definition: fileop.c:916
void file_create(int)
Definition: fileop.c:740
#define _STAT_LINK
Definition: fileop.c:86
char * mbuffer
Definition: fileop.c:81
void splash(void)
Definition: fileop.c:1315
#define _STAT_CREATE
Definition: fileop.c:83
void file_read(int)
Definition: fileop.c:1204
int range
Definition: fileop.c:139
void file_stat(int)
Definition: fileop.c:830
#define _STAT_CHMOD
Definition: fileop.c:91
int cret
Definition: fileop.c:138
#define _STAT_READDIR
Definition: fileop.c:92
void purge_buffer_cache()
Definition: fileop.c:147
int x
Definition: fileop.c:78
void dir_create(int)
Definition: fileop.c:594
void dir_traverse(int)
Definition: fileop.c:673
void file_unlink(int)
Definition: fileop.c:1055
int worst
Definition: fileop.c:141
#define _STAT_DIR_DELETE
Definition: fileop.c:94
int excel
Definition: fileop.c:78
#define _STAT_READ
Definition: fileop.c:95
void exit()
#define _STAT_WRITE
Definition: fileop.c:84
char * optarg
int dirlen
Definition: fileop.c:142
int i
Definition: fileop.c:140
int sz
Definition: fileop.c:80
double total_time
Definition: iozone.c:1268
Here is the call graph for this function:

◆ purge_buffer_cache()

void purge_buffer_cache ( )

Definition at line 147 of file fileop.c.

148 {
149  if (!mountname)
150  return;
151 
152  char cwd[PATH_MAX];
153  char command[1024];
154  int ret,i;
155 
156  junkp=(int *)getcwd(cwd, sizeof(cwd));
157  junk=chdir("/");
158  strcpy(command,"umount ");
159  strcat(command, mountname);
160  /*
161  umount might fail if the device is still busy, so
162  retry unmounting several times with increasing delays
163  */
164  for (i = 1; i < 10; ++i) {
165  ret = system(command);
166  if (ret == 0)
167  break;
168  sleep(i); /* seconds */
169  }
170  strcpy(command,"mount ");
171  strcat(command, mountname);
172  junk=system(command);
173  junk=chdir(cwd);
174 }
const char * mountname
Definition: fileop.c:136
int * junkp
Definition: fileop.c:77
int junk
Definition: fileop.c:77
long long ret
Definition: iozone.c:1346
#define PATH_MAX
Definition: fileop.c:68
int system()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ splash()

void splash ( void  )

Definition at line 1315 of file fileop.c.

1316 {
1317  printf("\n");
1318  printf(" --------------------------------------\n");
1319  printf(" | Fileop | \n");
1320  printf(" | %s | \n",version);
1321  printf(" | | \n");
1322  printf(" | by |\n");
1323  printf(" | | \n");
1324  printf(" | Don Capps |\n");
1325  printf(" --------------------------------------\n");
1326  printf("\n");
1327 }
char version[]
Definition: fileop.c:134
Here is the caller graph for this function:

◆ time_so_far()

static double time_so_far ( void  )
static

Definition at line 1279 of file fileop.c.

1281 {
1282 #ifdef Windows
1283  LARGE_INTEGER freq,counter;
1284  double wintime,bigcounter;
1285  /* For Windows the time_of_day() is useless. It increments in 55 milli second */
1286  /* increments. By using the Win32api one can get access to the high performance */
1287  /* measurement interfaces. With this one can get back into the 8 to 9 */
1288  /* microsecond resolution. */
1289  QueryPerformanceFrequency(&freq);
1290  QueryPerformanceCounter(&counter);
1291  bigcounter=(double)counter.HighPart *(double)0xffffffff +
1292  (double)counter.LowPart;
1293  wintime = (double)(bigcounter/(double)freq.LowPart);
1294  return((double)wintime);
1295 #else
1296 #if defined (OSFV4) || defined(OSFV3) || defined(OSFV5)
1297  struct timespec gp;
1298 
1299  if (getclock(TIMEOFDAY, (struct timespec *) &gp) == -1)
1300  perror("getclock");
1301  return (( (double) (gp.tv_sec)) +
1302  ( ((float)(gp.tv_nsec)) * 0.000000001 ));
1303 #else
1304  struct timeval tp;
1305 
1306  if (gettimeofday(&tp, (struct timezone *) NULL) == -1)
1307  perror("gettimeofday");
1308  return ((double) (tp.tv_sec)) +
1309  (((double) tp.tv_usec) * 0.000001 );
1310 #endif
1311 #endif
1312 }
int gettimeofday(void *ptr1, void *ptr2)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ usage()

void usage ( void  )

Definition at line 1330 of file fileop.c.

1331 {
1332  splash();
1333  printf(" fileop [-f X ]|[-l # -u #] [-s Y] [-e] [-b] [-w] [-d <dir>] [-t] [-v] [-h]\n");
1334  printf("\n");
1335  printf(" -f # Force factor. X^3 files will be created and removed.\n");
1336  printf(" -l # Lower limit on the value of the Force factor.\n");
1337  printf(" -u # Upper limit on the value of the Force factor.\n");
1338  printf(" -s # Optional. Sets filesize for the create/write. May use suffix 'K' or 'M'.\n");
1339  printf(" -e Excel importable format.\n");
1340  printf(" -b Output best case results.\n");
1341  printf(" -i # Increment force factor by this increment.\n");
1342  printf(" -w Output worst case results.\n");
1343  printf(" -d <dir> Specify starting directory.\n");
1344  printf(" -U <dir> Mount point to remount between tests.\n");
1345  printf(" -t Verbose output option.\n");
1346  printf(" -v Version information.\n");
1347  printf(" -h Help text.\n");
1348  printf("\n");
1349  printf(" The structure of the file tree is:\n");
1350  printf(" X number of Level 1 directories, with X number of\n");
1351  printf(" level 2 directories, with X number of files in each\n");
1352  printf(" of the level 2 directories.\n");
1353  printf("\n");
1354  printf(" Example: fileop 2\n");
1355  printf("\n");
1356  printf(" dir_1 dir_2\n");
1357  printf(" / \\ / \\ \n");
1358  printf(" sdir_1 sdir_2 sdir_1 sdir_2\n");
1359  printf(" / \\ / \\ / \\ / \\ \n");
1360  printf(" file_1 file_2 file_1 file_2 file_1 file_2 file_1 file_2\n");
1361  printf("\n");
1362  printf(" Each file will be created, and then Y bytes is written to the file.\n");
1363  printf("\n");
1364 }
void splash(void)
Definition: fileop.c:1315
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate()

int validate ( char *  buffer,
int  size,
char  value 
)

Definition at line 1373 of file fileop.c.

1374 {
1375  register int i;
1376  register char *cp;
1377  register int size1;
1378  register char v1;
1379  v1=value;
1380  cp = buffer;
1381  size1=size;
1382  for(i=0;i<size;i++)
1383  {
1384  if(*cp++ != v1)
1385  return(1);
1386  }
1387  return(0);
1388 }
char * buffer
Definition: iozone.c:1366
int i
Definition: fileop.c:140
Here is the caller graph for this function:

Variable Documentation

◆ best

int best

Definition at line 141 of file fileop.c.

◆ cret

int cret

Definition at line 138 of file fileop.c.

◆ dirlen

int dirlen

Definition at line 142 of file fileop.c.

◆ excel

int excel

Definition at line 78 of file fileop.c.

◆ i

int i

Definition at line 140 of file fileop.c.

◆ incr

int incr = 1

Definition at line 82 of file fileop.c.

◆ junk

int junk

Definition at line 77 of file fileop.c.

◆ junkp

int * junkp

Definition at line 77 of file fileop.c.

◆ lower

int lower

Definition at line 139 of file fileop.c.

◆ mbuffer

char* mbuffer

Definition at line 81 of file fileop.c.

◆ mountname

const char* mountname =NULL

Definition at line 136 of file fileop.c.

◆ range

int range

Definition at line 139 of file fileop.c.

◆ stats

struct stat_struct stats[_NUM_STATS]

◆ sz

int sz = 1

Definition at line 80 of file fileop.c.

◆ thedir

char thedir[PATH_MAX] ="."

Definition at line 135 of file fileop.c.

◆ upper

int upper

Definition at line 139 of file fileop.c.

◆ verbose

int verbose = 0

Definition at line 79 of file fileop.c.

◆ version

char version[] =THISVERSION

Definition at line 134 of file fileop.c.

◆ worst

int worst

Definition at line 141 of file fileop.c.

◆ x

int x

Definition at line 78 of file fileop.c.