📄 iozone.c
字号:
break; case 'G': /* Use msync sync for mmap file */ sprintf(splash[splash_line++],"\tUsing msync(MS_SYNC) on mmap files\n"); mmapssflag++; mmapnsflag=0; break; case 'C': /* show children xfer counts */ Cflag++; break; case 'Q': /* Enable output offset/latency files */ sprintf(splash[splash_line++],"\tOffset/latency files enabled.\n"); Q_flag++; break; case 'x': /* Disable stone_wall */ sprintf(splash[splash_line++],"\tStonewall disabled\n"); xflag++; break; case 'a': /* auto mode */ fetchon=1; purge=0; multi_buffer=0; auto_mode = 1; aflag++; sprintf(splash[splash_line++],"\tAuto Mode\n"); break; case 'c': /* Include close in timing */ include_close++; sprintf(splash[splash_line++],"\tInclude close in write timing\n"); break; case 'e': /* Include fsync in timing */ include_flush++; sprintf(splash[splash_line++],"\tInclude fsync in write timing\n"); break; case 'A': /* auto2 mode. Soon to go away. Please use -az */ fetchon=1; purge=0; multi_buffer=0; auto_mode = 1; aflag++; sprintf(splash[splash_line++],"\tAuto Mode 2. This option is obsolete. Use -az -i0 -i1 \n"); RWONLYflag++; NOCROSSflag++; include_tflag++; /* automatically set WRITER_TEST and READER_TEST */ include_test[WRITER_TEST]++; include_test[READER_TEST]++; break; case 's': /* Set file size */#ifdef NO_PRINT_LLD sscanf(optarg,"%ld",&kilobytes64);#else sscanf(optarg,"%lld",&kilobytes64);#endif if(optarg[strlen(optarg)-1]=='k' || optarg[strlen(optarg)-1]=='K'){ ; } if(optarg[strlen(optarg)-1]=='m' || optarg[strlen(optarg)-1]=='M'){ kilobytes64 = kilobytes64 * 1024; } if(optarg[strlen(optarg)-1]=='g' || optarg[strlen(optarg)-1]=='G'){ kilobytes64 = kilobytes64 *1024 * 1024; } if(kilobytes64 <= 0) kilobytes64=512; s_range[s_count++]=kilobytes64; max_file_size = (off64_t)s_range[s_count-1]; /* Make visable globally */ min_file_size = (off64_t)s_range[0]; /* Make visable globally */#ifdef NO_PRINT_LLD sprintf(splash[splash_line++],"\tFile size set to %ld KB\n",kilobytes64);#else sprintf(splash[splash_line++],"\tFile size set to %lld KB\n",kilobytes64);#endif sflag++; break; case 'l': /* Set lower thread/proc limit */ mint = (long long)(atoi(optarg)); if(mint <= 0) { mint=1; num_child=1; }else num_child=mint; if(mint > (unsigned long long)MAXSTREAMS){ printf("Invalid options: maximum streams for "); printf("throughput is MAXSTREAMS\n"); exit(4); } lflag++; trflag++; if(Uflag) { printf("Can not run throughput tests with unmount & remounts.\n"); exit(5); } break; case 'u': /* Set upper thread/proc limit */ maxt = (long long)(atoi(optarg)); if(maxt <= 0) maxt=1; if(maxt > MAXSTREAMS){ printf("Invalid options: maximum streams for "); printf("throughput is MAXSTREAMS\n"); exit(6); } uflag++; trflag++; if(Uflag) { printf("Can not run throughput tests with unmount & remounts.\n"); exit(7); } break; case 'm': /* Use multiple buffers */ fetchon=0; multi_buffer=1; mflag++; mbuffer = (char *) alloc_mem((long long)MAXBUFFERSIZE,(int)0); if(mbuffer == 0) { perror("Memory allocation failed:"); exit(8); } sprintf(splash[splash_line++],"\tMulti_buffer. Work area %d bytes\n", MAXBUFFERSIZE); break; case 'M': /* Report machine name and OS */ bzero(reply,sizeof(reply)); pi=popen("uname -a", "r"); if(pi == (FILE *)0) { sprintf(splash[splash_line++],"\n\tError using popen() on uname\n"); sprintf(splash[splash_line++],"\t-M option suppressed.\n"); } else { fread(reply,IBUFSIZE-1,1,pi); pclose(pi); m=reply; while(*m) /* Strip new line */ { if(*m=='\n') *m=0; else m++; } sprintf(splash[splash_line++],"\n\tMachine = %s\n",reply); } break; case 'P': /* Set beginning processor for binding. */#ifndef NO_THREADS#ifdef _HPUX_SOURCE num_processors= pthread_num_processors_np(); begin_proc = atoi(optarg); if(begin_proc < 0) begin_proc=0; if(begin_proc > num_processors) begin_proc=0; sprintf(splash[splash_line++],"\tBinding of processors beginning with %d \n",begin_proc); ioz_processor_bind++;#else sprintf(splash[splash_line++],"\tProcessor binding not available in this version\n");#endif#endif break; case 'p': /* purge the processor cache */ sprintf(splash[splash_line++],"\tPurge Mode On\n"); fetchon=0; pflag++; purge=1; break; case 'h': /* show help */ hflag++; show_help(); exit(0); break; case 'E': /* Extended testing for pread/pwrite... */ Eflag++; break; case 'R': /* Generate Excel compatible Report */ Rflag++; sprintf(splash[splash_line++],"\tExcel chart generation enabled\n"); break; case 'o': /* Open OSYNC */ sprintf(splash[splash_line++],"\tSYNC Mode. \n"); oflag++; break; case 'O': /* Report in Ops/sec instead of KB/sec */ sprintf(splash[splash_line++],"\tOPS Mode. Output is in operations per second.\n"); OPS_flag++; break; case 'N': /* Report in usec/op */ sprintf(splash[splash_line++],"\tMicroseconds/op Mode. Output is in microseconds per operation.\n"); MS_flag++; break; case 'V': /* Turn on Verify every byte */ sverify=0; inp_pat = (char)(atoi(optarg)); if(inp_pat == 0) inp_pat = PATTERN; pattern = ((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) | inp_pat); verify=1; sprintf(splash[splash_line++],"\tVerify Mode. Pattern %x\n",pattern); sprintf(splash[splash_line++],"\tPerformance measurements are invalid in this mode.\n"); break; case 'S': /* Set the processor cache size */ cache_size = (long)(atoi(optarg)*1024); if(cache_size == 0) cache_size = CACHE_SIZE; break; case 'L': /* Set processor cache line size */ cache_line_size = (long)(atoi(optarg)); if(cache_line_size == 0) cache_line_size = CACHE_LINE_SIZE; break; case 'f': /* Specify the file name */ if(mfflag) { printf("invalid options: -f and -F are mutually exclusive\n"); exit(10); } fflag++; strcpy(filename,optarg); sprintf(dummyfile[0],"%s.DUMMY",optarg); break; case 'b': /* Specify the biff file name */ Rflag++; bif_flag++; strcpy(bif_filename,optarg); break; case 'F': /* Specify multiple file names for -t */ mfflag++; if(fflag) { printf("invalid options: -f and -F are mutually exclusive\n"); exit(11); } if(!trflag) { printf("invalid options: must specify -t N before -F\n"); exit(12); } optind--; for(fileindx=0;fileindx<maxt;fileindx++) { filearray[fileindx]=argv[optind++]; if(optind > argc) {#ifdef NO_PRINT_LLD printf("invalid options: not enough filenames for %ld streams\n",num_child);#else printf("invalid options: not enough filenames for %lld streams\n",num_child);#endif exit(13); } } break; case 'r': /* Specify the record size to use */ rflag++; reclen = ((long long)(atoi(optarg))*1024); if(optarg[strlen(optarg)-1]=='k' || optarg[strlen(optarg)-1]=='K'){ reclen = (long long)(1024 * atoi(optarg)); } if(optarg[strlen(optarg)-1]=='m' || optarg[strlen(optarg)-1]=='M'){ reclen = (long long)(1024 * 1024 * atoi(optarg)); } if(optarg[strlen(optarg)-1]=='g' || optarg[strlen(optarg)-1]=='G'){ reclen = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg)); } if(reclen <= 0) reclen=(long long)4096; r_range[r_count++]=reclen; max_rec_size = (off64_t)r_range[r_count-1]; /* Make visable globally */ min_rec_size = (off64_t)r_range[0]; /* Make visable globally */#ifdef NO_PRINT_LLD sprintf(splash[splash_line++],"\tRecord Size %ld KB\n",reclen/1024);#else sprintf(splash[splash_line++],"\tRecord Size %lld KB\n",reclen/1024);#endif if(max_rec_size > MAXBUFFERSIZE) {#ifdef NO_PRINT_LLD printf("Error: maximum record size %ld KB is greater than maximum buffer size %ld KB\n ", max_rec_size/1024, MAXBUFFERSIZE/1024);#else printf("Error: maximum record size %lld KB is greater than maximum buffer size %lld KB\n ", (long long)(max_rec_size/1024LL), (long long)MAXBUFFERSIZE/1024LL);#endif exit(23); } break; case 'J': /* Specify the compute time in millisecs */ compute_time = (float)(atoi(optarg)); compute_time=compute_time/1000; if(compute_time < (float)0) compute_time=(float)0; else compute_flag=1; jflag++; break; case 'j': /* Specify the stride in records */ stride = (long long)(atoi(optarg)); if(stride < 0) stride=0; stride_flag=1; break; case 't': /* Specify the number of children to run */ num_child1=(atoi(optarg)); num_child = (long long)num_child1; if(num_child > (long long)MAXSTREAMS) { printf("invalid options: maximum streams for throughput is MAXSTREAMS\n");#ifdef NO_PRINT_LLD printf("Numchild %ld %s\n",num_child,optarg);#else printf("Numchild %lld %s\n",num_child,optarg);#endif exit(14); } if(num_child <= 0) num_child = 8; if(num_child == 0) num_child=1; mint=maxt=num_child; trflag++; if(Uflag) { printf("Can not run throughput tests with unmount & remounts.\n"); exit(15); } break; case 'd': /* Specify the delay of children to run */ delay_start = (long long)(atoi(optarg)); if(delay_start < 0) delay_start=0; break; case 'i': /* Specify specific tests */ tval=(long long)(atoi(optarg)); if(tval < 0) tval=0;#ifndef HAVE_PREAD if(tval > RANDOM_MIX_TEST) { printf("\tPread tests not available on this operating system.\n"); exit(183); }#endif if(tval > sizeof(func)/sizeof(char *)) { tval=0; sprintf(splash[splash_line++],"\tSelected test not available on the version.\n"); } include_test[tval]++; include_tflag++; break; case 'v': /* Show version information */ for(ind=0; strlen(head1[ind]); ind++) { printf("%s\n", head1[ind]); } exit(0); break; case 'U': /* Specify the dev name for umount/mount*/ Uflag++; strcpy(mountname,optarg); if(trflag) { printf("Can not run throughput tests with unmount & remounts.\n"); exit(16); } break; case 'w': /* Do not unlink files */ sprintf(splash[splash_line++],"\tSetting no_unlink\n"); no_unlink = 1; break; case 'Z': /* Turn on the mmap and file I/O mixing */ sprintf(splash[splash_line++],"\tEnable mmap & file I/O mixing.\n"); mmap_mix = 1; break; case 'W': /* Read/Write with file locked */ file_lock=1; sprintf(splash[splash_line++],"\tLock file when reading/writing.\n"); break; case 'K': /* Cause disrupted read pattern */ disrupt_flag=1; sprintf(splash[splash_line++],"\tDisrupted read patterns selected.\n"); break; case 'X': /* Open write telemetry file */ compute_flag=1; sverify=2; /* touch lightly */ w_traj_flag=1; strcpy(write_traj_filename,optarg); traj_vers(); w_traj_size(); sprintf(splash[splash_line++],"\tUsing write telemetry file \"%s\"\n", write_traj_filename); w_traj_fd=open_w_traj(); if(w_traj_fd == (FILE *)0) exit(200); break; case 'Y': /* Open Read telemetry file */ compute_flag=1; sverify=2; /* touch lightly */ r_traj_flag=1; strcpy(read_traj_filename,optarg); sprintf(splash[splash_line++],"\tUsing read telemetry file \"%s\"\n", read_traj_filename); traj_vers(); r_traj_size(); r_traj_fd=open_r_traj(); if(r_traj_fd == (FILE*) 0) exit(200); break; case 'n': /* Set min file size for auto mode */ nflag=1; minimum_file_size = (off64_t)atoi(optarg); if(optarg[strlen(optarg)-1]=='k' || optarg[strlen(optarg)-1]=='K'){ ; } if(optarg[strlen(optarg)-1]=='m' || optarg[strlen(optarg)-1]=='M'){ minimum_file_size = (long long)(1024 * atoi(optarg)); } if(optarg[strlen(optarg)-1]=='g' || optarg[strlen(optarg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -