static int moddir_rmdir( INSTANCE * my, int * params ) { const char * d = string_get( params[ 0 ] ) ; int ret = dir_delete( d ); string_discard( params[ 0 ] ) ; return ( ret ) ; }
Boolean shelf_delete(void) { return dir_delete(shelfdir); }
int main(int argc, char **argv) { if(argc == 1) { usage(); exit(1); } while((cret = getopt(argc,argv,"bwetvf:s:l:u: ")) != EOF) { switch(cret) { case 'f': /* Force factor */ x=atoi(optarg); if(x < 0) x=1; break; case 's': /* Size of files */ sz=atoi(optarg); if(optarg[strlen(optarg)-1]=='k' || optarg[strlen(optarg)-1]=='K') { sz = (1024 * atoi(optarg)); } if(optarg[strlen(optarg)-1]=='m' || optarg[strlen(optarg)-1]=='M') { sz = (1024 * 1024 * atoi(optarg)); } if(sz < 0) sz=1; break; case 'l': /* lower force value */ lower=atoi(optarg); range=1; if(lower < 0) lower=1; break; case 'v': /* version */ splash(); exit(0); break; case 'u': /* upper force value */ upper=atoi(optarg); range=1; if(upper < 0) upper=1; break; case 't': /* verbose */ verbose=1; break; case 'e': /* Excel */ excel=1; break; case 'b': /* Best */ best=1; break; case 'w': /* Worst */ worst=1; break; } } mbuffer=(char *)malloc(sz); memset(mbuffer,'a',sz); if(!excel) printf("\nFileop: File size is %d, Output is in Ops/sec. (A=Avg, B=Best, W=Worst)\n",sz); if(!verbose) { #ifdef Windows printf(" . %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %12s\n", "mkdir","rmdir","create","read","write","close","stat", "access","chmod","readdir","delete"," Total_files"); #else printf(" . %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %12s\n", "mkdir","rmdir","create","read","write","close","stat", "access","chmod","readdir","link ","unlink","delete", " Total_files"); #endif } if(x==0) x=1; if(range==0) lower=upper=x; for(i=lower; i<=upper; i++) { clear_stats(); x=i; /* * Dir Create test */ dir_create(x); if(verbose) { printf("mkdir: Dirs = %9lld ",stats[_STAT_DIR_CREATE].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_DIR_CREATE].total_time); printf(" Avg mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_DIR_CREATE].counter/stats[_STAT_DIR_CREATE].total_time, stats[_STAT_DIR_CREATE].total_time/stats[_STAT_DIR_CREATE].counter); printf(" Best mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n",1/stats[_STAT_DIR_CREATE].best,stats[_STAT_DIR_CREATE].best); printf(" Worst mkdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",1/stats[_STAT_DIR_CREATE].worst,stats[_STAT_DIR_CREATE].worst); } /* * Dir delete test */ dir_delete(x); if(verbose) { printf("rmdir: Dirs = %9lld ",stats[_STAT_DIR_DELETE].counter); printf("Total Time = %12.9f seconds\n",stats[_STAT_DIR_DELETE].total_time); printf(" Avg rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_DIR_DELETE].counter/stats[_STAT_DIR_DELETE].total_time, stats[_STAT_DIR_DELETE].total_time/stats[_STAT_DIR_DELETE].counter); printf(" Best rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n",1/stats[_STAT_DIR_DELETE].best,stats[_STAT_DIR_DELETE].best); printf(" Worst rmdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n",1/stats[_STAT_DIR_DELETE].worst,stats[_STAT_DIR_DELETE].worst); } /* * Create test */ file_create(x); if(verbose) { printf("create: Files = %9lld ",stats[_STAT_CREATE].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_CREATE].total_time); printf(" Avg create(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_CREATE].counter/stats[_STAT_CREATE].total_time, stats[_STAT_CREATE].total_time/stats[_STAT_CREATE].counter); printf(" Best create(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_CREATE].best,stats[_STAT_CREATE].best); printf(" Worst create(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_CREATE].worst,stats[_STAT_CREATE].worst); printf("write: Files = %9lld ",stats[_STAT_WRITE].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_WRITE].total_time); printf(" Avg write(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_WRITE].counter/stats[_STAT_WRITE].total_time, stats[_STAT_WRITE].total_time/stats[_STAT_WRITE].counter); printf(" Best write(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_WRITE].best,stats[_STAT_WRITE].best); printf(" Worst write(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_WRITE].worst,stats[_STAT_WRITE].worst); printf("close: Files = %9lld ",stats[_STAT_CLOSE].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_CLOSE].total_time); printf(" Avg close(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_CLOSE].counter/stats[_STAT_CLOSE].total_time, stats[_STAT_CLOSE].total_time/stats[_STAT_CLOSE].counter); printf(" Best close(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_CLOSE].best,stats[_STAT_CLOSE].best); printf(" Worst close(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_CLOSE].worst,stats[_STAT_CLOSE].worst); } /* * Stat test */ file_stat(x); if(verbose) { printf("stat: Files = %9lld ",stats[_STAT_STAT].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_STAT].total_time); printf(" Avg stat(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_STAT].counter/stats[_STAT_STAT].total_time, stats[_STAT_STAT].total_time/stats[_STAT_STAT].counter); printf(" Best stat(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_STAT].best,stats[_STAT_STAT].best); printf(" Worst stat(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_STAT].worst,stats[_STAT_STAT].worst); } /* * Read test */ file_read(x); if(verbose) { printf("read: Files = %9lld ",stats[_STAT_READ].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_READ].total_time); printf(" Avg read(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_READ].counter/stats[_STAT_READ].total_time, stats[_STAT_READ].total_time/stats[_STAT_READ].counter); printf(" Best read(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_READ].best,stats[_STAT_READ].best); printf(" Worst read(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_READ].worst,stats[_STAT_READ].worst); } /* * Access test */ file_access(x); if(verbose) { printf("access: Files = %9lld ",stats[_STAT_ACCESS].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_ACCESS].total_time); printf(" Avg access(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_ACCESS].counter/stats[_STAT_ACCESS].total_time, stats[_STAT_ACCESS].total_time/stats[_STAT_ACCESS].counter); printf(" Best access(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_ACCESS].best,stats[_STAT_ACCESS].best); printf(" Worst access(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_ACCESS].worst,stats[_STAT_ACCESS].worst); } /* * Chmod test */ file_chmod(x); if(verbose) { printf("chmod: Files = %9lld ",stats[_STAT_CHMOD].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_CHMOD].total_time); printf(" Avg chmod(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_CHMOD].counter/stats[_STAT_CHMOD].total_time, stats[_STAT_CHMOD].total_time/stats[_STAT_CHMOD].counter); printf(" Best chmod(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_CHMOD].best,stats[_STAT_CHMOD].best); printf(" Worst chmod(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_CHMOD].worst,stats[_STAT_CHMOD].worst); } /* * readdir test */ file_readdir(x); if(verbose) { printf("readdir: Files = %9lld ",stats[_STAT_READDIR].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_READDIR].total_time); printf(" Avg readdir(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_READDIR].counter/stats[_STAT_READDIR].total_time, stats[_STAT_READDIR].total_time/stats[_STAT_READDIR].counter); printf(" Best readdir(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_READDIR].best,stats[_STAT_READDIR].best); printf(" Worst readdir(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_READDIR].worst,stats[_STAT_READDIR].worst); } #if !defined(Windows) /* * link test */ file_link(x); if(verbose) { printf("link: Files = %9lld ",stats[_STAT_LINK].counter); printf("Total Time = %12.9f seconds\n",stats[_STAT_LINK].total_time); printf(" Avg link(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_LINK].counter/stats[_STAT_LINK].total_time, stats[_STAT_LINK].total_time/stats[_STAT_LINK].counter); printf(" Best link(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_LINK].best,stats[_STAT_LINK].best); printf(" Worst link(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_LINK].worst,stats[_STAT_LINK].worst); } /* * unlink test */ file_unlink(x); if(verbose) { printf("unlink: Files = %9lld ",stats[_STAT_UNLINK].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_UNLINK].total_time); printf(" Avg unlink(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_UNLINK].counter/stats[_STAT_UNLINK].total_time, stats[_STAT_UNLINK].total_time/stats[_STAT_UNLINK].counter); printf(" Best unlink(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_UNLINK].best,stats[_STAT_UNLINK].best); printf(" Worst unlink(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_UNLINK].worst,stats[_STAT_UNLINK].worst); } #endif /* * Delete test */ file_delete(x); if(verbose) { printf("delete: Files = %9lld ",stats[_STAT_DELETE].counter); printf("Total Time = %12.9f seconds\n", stats[_STAT_DELETE].total_time); printf(" Avg delete(s)/sec = %12.2f (%12.9f seconds/op)\n", stats[_STAT_DELETE].counter/stats[_STAT_DELETE].total_time, stats[_STAT_DELETE].total_time/stats[_STAT_DELETE].counter); printf(" Best delete(s)/sec = %12.2f (%12.9f seconds/op)\n", 1/stats[_STAT_DELETE].best,stats[_STAT_DELETE].best); printf(" Worst delete(s)/sec = %12.2f (%12.9f seconds/op)\n\n", 1/stats[_STAT_DELETE].worst,stats[_STAT_DELETE].worst); } if(!verbose) { printf("%c %4d %6.0f ",'A',x,stats[_STAT_DIR_CREATE].counter/stats[_STAT_DIR_CREATE].total_time); printf("%6.0f ",stats[_STAT_DIR_DELETE].counter/stats[_STAT_DIR_DELETE].total_time); printf("%6.0f ",stats[_STAT_CREATE].counter/stats[_STAT_CREATE].total_time); printf("%6.0f ",stats[_STAT_READ].counter/stats[_STAT_READ].total_time); printf("%6.0f ",stats[_STAT_WRITE].counter/stats[_STAT_WRITE].total_time); printf("%6.0f ",stats[_STAT_CLOSE].counter/stats[_STAT_CLOSE].total_time); printf("%6.0f ",stats[_STAT_STAT].counter/stats[_STAT_STAT].total_time); printf("%6.0f ",stats[_STAT_ACCESS].counter/stats[_STAT_ACCESS].total_time); printf("%6.0f ",stats[_STAT_CHMOD].counter/stats[_STAT_CHMOD].total_time); printf("%6.0f ",stats[_STAT_READDIR].counter/stats[_STAT_READDIR].total_time); #ifndef Windows printf("%6.0f ",stats[_STAT_LINK].counter/stats[_STAT_LINK].total_time); printf("%6.0f ",stats[_STAT_UNLINK].counter/stats[_STAT_UNLINK].total_time); #endif printf("%6.0f ",stats[_STAT_DELETE].counter/stats[_STAT_DELETE].total_time); printf("%12d ",x*x*x); printf("\n"); fflush(stdout); if(best) { printf("%c %4d %6.0f ",'B',x, 1/stats[_STAT_DIR_CREATE].best); printf("%6.0f ",1/stats[_STAT_DIR_DELETE].best); printf("%6.0f ",1/stats[_STAT_CREATE].best); printf("%6.0f ",1/stats[_STAT_READ].best); printf("%6.0f ",1/stats[_STAT_WRITE].best); printf("%6.0f ",1/stats[_STAT_CLOSE].best); printf("%6.0f ",1/stats[_STAT_STAT].best); printf("%6.0f ",1/stats[_STAT_ACCESS].best); printf("%6.0f ",1/stats[_STAT_CHMOD].best); printf("%6.0f ",1/stats[_STAT_READDIR].best); #ifndef Windows printf("%6.0f ",1/stats[_STAT_LINK].best); printf("%6.0f ",1/stats[_STAT_UNLINK].best); #endif printf("%6.0f ",1/stats[_STAT_DELETE].best); printf("%12d ",x*x*x); printf("\n"); fflush(stdout); } if(worst) { printf("%c %4d %6.0f ",'W',x, 1/stats[_STAT_DIR_CREATE].worst); printf("%6.0f ",1/stats[_STAT_DIR_DELETE].worst); printf("%6.0f ",1/stats[_STAT_CREATE].worst); printf("%6.0f ",1/stats[_STAT_READ].worst); printf("%6.0f ",1/stats[_STAT_WRITE].worst); printf("%6.0f ",1/stats[_STAT_CLOSE].worst); printf("%6.0f ",1/stats[_STAT_STAT].worst); printf("%6.0f ",1/stats[_STAT_ACCESS].worst); printf("%6.0f ",1/stats[_STAT_CHMOD].worst); printf("%6.0f ",1/stats[_STAT_READDIR].worst); #ifndef Windows printf("%6.0f ",1/stats[_STAT_LINK].worst); printf("%6.0f ",1/stats[_STAT_UNLINK].worst); #endif printf("%6.0f ",1/stats[_STAT_DELETE].worst); printf("%12d ",x*x*x); printf("\n"); fflush(stdout); } } } return(0); }
Boolean cur_delete(void) { return dir_delete(curdir); }