--- /tmp/netmist.c 2014-11-26 10:14:27.000000000 -0600 +++ netmist.c 2014-11-26 10:08:51.000000000 -0600 @@ -100,7 +100,7 @@ #else #define MALLOC(x) my_malloc(x) #endif -#define THISVERSION " $Revision: 991 $" +#define THISVERSION " $Revision: 1023 $" char version[]=THISVERSION; #if defined(Windows) || defined(_linux_) || defined (_bsd_)||defined(WIN32) ||defined(_cygwin_) || defined(_solaris_) @@ -714,12 +714,12 @@ char log_filename[MAXNAME]; char log_beat_filename[MAXNAME]; -/* Note: with trace debug, O_CREAT=1 and O_RDWR=1 are assumed and not reported */ -int tracedebug = 0; -/* enabling tracing during init makes very large trace logs */ -/* -#define INIT_TRACE_DEBUG +/* Note: with trace debug, O_CREAT=1 and O_RDWR=1 are assumed and not reported + tracedebug = 0: no tracing + tracedebug = 1: tracing enabled, except during initialization + tracedebug = 2: tracing enabled for all operations (WARNING: HUGE LOGS) */ +int tracedebug = 0; unsigned long trace_seq = 0; /* trace log sequence number */ #define TRACE_STATE_SETUP 0 #define TRACE_STATE_VALIDATION 1 @@ -730,6 +730,7 @@ int tracestate = TRACE_STATE_SETUP; /* tracks the state of client for trace log */ const char *trace_states[] = { "Setup","Validation","Create","Warmup","Run","Cleanup" }; +int do_validate = 1; /* * Holds name of the file that contains the import op dist */ @@ -987,6 +988,7 @@ int c_cleanup; int c_dump_files_flag; int c_tracedebug; + int c_do_validate; int c_ipv6_enable; int c_licensed; int c_heartbeat; @@ -1040,6 +1042,7 @@ char c_cleanup[4]; char c_dump_files_flag[4]; char c_tracedebug[4]; + char c_do_validate[4]; char c_ipv6_enable[4]; char c_licensed[4]; char c_heartbeat[4]; @@ -1551,7 +1554,7 @@ /* * Total number of clients running the test. */ -int num_clients,p_num_clients; +int num_clients,p_num_clients,no_last_proc; int debug = 0; @@ -1674,6 +1677,7 @@ double cur_time,my_run_time,last_heart_beat; double my_start_time, post_time; double my_start_time2; +double my_cur_time, my_last_time; /* ELAP_T Collect this many seconds worth of samples */ @@ -1939,7 +1943,7 @@ strcpy(pit_service,"PIT"); /* Default */ - while((cret = getopt(argc,argv,"zNKYXFGDLvkimhux2c:o:O:Q:T:H:l:S:n:r:s:p:C:e:g:f:j:t:M:R:U:b:B:d:P:w:W:EI:a:y:J:V:A:Z:q: ")) != EOF){ + while((cret = getopt(argc,argv,"zNKYXFGDLvkimhux32:c:o:O:Q:T:H:l:S:n:r:s:p:C:e:g:f:j:t:M:R:U:b:B:d:P:w:W:EI:a:y:J:V:A:Z:q: ")) != EOF){ switch(cret){ case 'F': /* Disable flushes */ flush_flag = 0; @@ -2229,7 +2233,16 @@ dump_files_flag=1; break; case '2': /* Dump files flag */ - tracedebug=1; + tracedebug=atoi(optarg); + if(tracedebug < 0) + { + printf("Negative tracedebug not supported.\n"); + fflush(stdout); + exit(1); + } + break; + case '3': /* Disable client_validate */ + do_validate=0; break; case 'X': /* Sharing flag */ sharing_flag=1; @@ -2444,6 +2457,16 @@ } } + if(do_validate == 0) + { + printf("**** Op validate is disabled. ****\n"); + fflush(stdout); + if(log_flag) + { + fprintf(log_out,"**** Op validatiion is disabled. ****\n"); + fflush(log_out); + } + } if(flush_flag == 0) { printf("**** Flushes are disabled. ****\n"); @@ -2453,9 +2476,7 @@ fprintf(log_out,"**** Flushes are disabled. ****\n"); fflush(log_out); } - } - if(twarn) { printf("**** Minimum run time of 300 enforced. ****\n"); @@ -4149,10 +4170,11 @@ fflush(newstdout); exit(1); } - fprintf(tracefile,"Thread,Sequence,State,Op,Action,File,Mode,Offset,IO Size,Access count,Other\n"); - fprintf(tracefile,"%d,%lu,%s,,Trace Log Open,%s,,,,,%s\n", - client_id,trace_seq++,trace_states[tracestate],localtracename, - get_timestamp(&time_string[0])); + cached_open_count++; /* We used a file descriptor here... */ + fprintf(tracefile,"Timestamp,Thread,Sequence,State,Op,Action,File,Mode,Offset,IO Size,Access count,Other\n"); + fprintf(tracefile,"%s,%d,%lu,%s,,Trace Log Open,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],localtracename); } /* Setup the workload name to my_workload relationship */ @@ -4379,9 +4401,9 @@ } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,,assigned workload = %s,,,,,,\n", - client_id,trace_seq++,trace_states[tracestate], - my_mix_table[my_workload].workload_name); + fprintf(tracefile,"%s,%d,%lu,%s,,assigned workload = %s,,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],my_mix_table[my_workload].workload_name); /* * Impersonate is used to have all files be shared by @@ -4515,7 +4537,8 @@ } fprintf(newstdout, "Starting op validation\n"); fflush(newstdout); - client_validate_ops(); + if(do_validate) + client_validate_ops(); fprintf(newstdout, "Finished op validation\n"); fflush(newstdout); @@ -4910,8 +4933,9 @@ */ if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,,Trace Log Close,,,,,,%s\n",client_id,trace_seq++, - trace_states[tracestate],get_timestamp(&time_string[0])); + fprintf(tracefile,"%s,%d,%lu,%s,,Trace Log Close,,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate]); fflush(tracefile); fclose(tracefile); } @@ -6941,10 +6965,10 @@ /* Truncate back to original size */ I_TRUNC(fp->filename,(fp->Original_fsize*(long long)1024)); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,append,(prefix) Truncate,%s,,%lld,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->Original_fsize*(long long)1024, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,append,(prefix) Truncate,%s,,%lld,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename, + fp->Original_fsize*(long long)1024,fp->access_count); total_file_ops+=1; work_obj[my_workload].total_file_ops+=1; work_obj[my_workload].open_op_count++; /* Count somewhere */ @@ -6958,17 +6982,17 @@ fflush(newstdout); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mkdir,(prefix) Stat,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->dirname,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,mkdir,(prefix) Stat,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->dirname,fp->access_count); #if defined(WIN32) wret = GetFileAttributes(fp->dirname); if(wret != INVALID_FILE_ATTRIBUTES) { if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mkdir,(prefix) Rmdir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->access_count,fp->dirname); + fprintf(tracefile,"%s,%d,%lu,%s,mkdir,(prefix) Rmdir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->dirname,fp->access_count); ret=rmdir(fp->dirname); if( ret != 0 ) { @@ -6981,9 +7005,9 @@ if( ret == 0 ) { if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mkdir,(prefix) Rmdir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->dirname,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,mkdir,(prefix) Rmdir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->dirname,fp->access_count); ret=rmdir(fp->dirname); if( ret < 0 ) { @@ -7008,9 +7032,9 @@ case OP_CREATE: /* Prefix is to remove any from previous create */ if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,create,(prefix) Unlink,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,create,(prefix) Unlink,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); unlink(fp->filename); break; case OP_READDIR: @@ -7089,17 +7113,17 @@ } /* Create an empty file */ if(tracedebug) /* this is a dup if init logging is on */ - fprintf(tracefile,"%d,%lu,%s,unlink,(postfix) Create,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,unlink,(postfix) Create,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); (*Netmist_Ops[my_workload].init_empty_file)(fp->filename); break; case OP_CREATE: /* Post-fix is to remove any from previous create */ if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,create,(postfix) Unlink,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,create,(postfix) Unlink,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); unlink(fp->filename); break; case OP_COPYFILE: @@ -7115,9 +7139,9 @@ strcat(altname,"_2"); /* Put it back */ if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rename,(postfix) Rename,%s,,,,%ld,newname=%s\n", - client_id,trace_seq++,trace_states[tracestate], - altname,fp->access_count,fp->filename); + fprintf(tracefile,"%s,%d,%lu,%s,rename,(postfix) Rename,%s,,,,%ld,newname=%s\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],altname,fp->access_count,fp->filename); rename(altname,fp->filename); break; case OP_STATFS: @@ -7367,7 +7391,7 @@ if(pct_complete && (pct_complete != prev_pct_complete) && ((pct_complete % 10) == 0) && (client_id == (num_clients-1))) - { + { tell_master_pct_complete(pct_complete,real_client_id, R_PERCENT_I_COMPLETE); prev_pct_complete = pct_complete; @@ -7375,14 +7399,28 @@ } else { - /* Create a file, to indicate that this dir is being worked */ - push_name(dir_buf); /* save name for delayed unlink */ - strcpy(tmp_file.filename,dir_buf); - (*Netmist_Ops[my_workload].init_empty_file)(dir_buf); - if(c_eval ==0) - locked_dir = 1; /* Locked by me */ - else - locked_dir = 0; /* Locked by some other */ + /* Create a file, to indicate that this dir is being worked */ + push_name(dir_buf); /* save name for delayed unlink */ + strcpy(tmp_file.filename,dir_buf); + (*Netmist_Ops[my_workload].init_empty_file)(dir_buf); + if(c_eval ==0) + locked_dir = 1; /* Locked by me */ + else + locked_dir = 0; /* Locked by some other */ + + /* Percent done */ + tot=NUM_OP_TYPES*client_dirs*client_files; + pct_complete=(file_count*100)/tot; + if(pct_complete > 100) + pct_complete = 100; + if(pct_complete && (pct_complete != prev_pct_complete) + && ((pct_complete % 10) == 0) + && (client_id == (num_clients-1))) + { + tell_master_pct_complete(pct_complete,real_client_id, + R_PERCENT_I_COMPLETE); + prev_pct_complete = pct_complete; + } } } @@ -7764,11 +7802,10 @@ int fd; long long i; buf=main_buf; -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,purge_file,Open,%s,0666,,,O_RDONLY=1\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,purge_file,Open,%s,0666,,,O_RDONLY=1\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); fd=I_OPEN(filename,O_RDONLY,0666); if(fd < 0) { @@ -7782,12 +7819,10 @@ } for(i=0 ; i<(file_ptr->Original_fsize*1024) ; i+=(max_xfer_size)) { -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,purge_file,Read,%s,,%lld,%d,,\n", - client_id,trace_seq++,trace_states[tracestate],filename,i, - max_xfer_size); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,purge_file,Read,%s,,%lld,%d,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename,i,max_xfer_size); ret=read(fd,buf,max_xfer_size); if(ret < 0) { @@ -7801,11 +7836,10 @@ } } cache_file_space+=(file_ptr->Original_fsize); -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,purge_file,Close,%s,,,,,\n",client_id, - trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug>1) + fprintf(tracefile,"%s,%d,%lu,%s,purge_file,Close,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); close(fd); return; } @@ -7876,9 +7910,9 @@ fd = fp->file_desc; if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,write,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -7914,11 +7948,11 @@ } if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, - ((flags2 & 1)?1:0), - ((flags2 & 2)?1:0)); + fprintf(tracefile,"%s,%d,%lu,%s,write,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, + ((flags2 & 1)?1:0), + ((flags2 & 2)?1:0)); } if( (cached_open_count+10 < max_open) && !(fp->file_desc)) { @@ -8097,10 +8131,10 @@ { if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write,Write,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,(long long)fp->seqwrite_offset,trans, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,write,Write,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,(long long)fp->seqwrite_offset, + trans,fp->access_count); } } #if defined(WIN32) @@ -8133,7 +8167,8 @@ I_FSYNC(fd); if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write,Sync file,%s,,,,%ld,\n",client_id,trace_seq++, + fprintf(tracefile,"%s,%d,%lu,%s,write,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],fp->filename,fp->access_count); } } @@ -8160,7 +8195,8 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write,Closed file,%s,,,,%ld,\n",client_id,trace_seq++, + fprintf(tracefile,"%s,%d,%lu,%s,write,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],fp->filename,fp->access_count); } } @@ -8246,9 +8282,9 @@ use_cached_fd=1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_file,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,write_file,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -8283,9 +8319,9 @@ } if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write_file,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,write_file,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -8468,9 +8504,10 @@ R_exit(110); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_file,Write file,%s,,%lld,%d,%ld,transferred=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - (long long)fp->wholefilewrite_offset,trans,fp->access_count,ret); + fprintf(tracefile,"%s,%d,%lu,%s,write_file,Write file,%s,,%lld,%d,%ld,transferred=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,(long long)fp->wholefilewrite_offset, + trans,fp->access_count,ret); #if defined(WIN32) /*query current file wholefilewrite_offset*/ largeoffset.QuadPart = 0; @@ -8503,9 +8540,9 @@ { I_FSYNC(fd); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_file,Sync file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,write_file,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } total_write_bytes += (double)(transferred); @@ -8530,9 +8567,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write_file,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,write_file,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } if(!use_cached_fd) @@ -8618,9 +8655,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_rand,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,write_rand,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -8653,9 +8690,9 @@ R_exit(111); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_rand,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,write_rand,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); if( (cached_open_count+10 < max_open) && !(fp->file_desc)) @@ -8901,8 +8938,8 @@ R_exit(112); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_rand,Random write,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,write_rand,Random write,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->offset,trans,fp->access_count); #if defined(WIN32) largeoffset.QuadPart = 0; @@ -8921,9 +8958,9 @@ { I_FSYNC(fd); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,write_rand,Sync file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,write_rand,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } total_write_rand_bytes+=(double)(ret); @@ -8953,7 +8990,8 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,write_rand,Closed file,%s,,,,%ld,\n",client_id,trace_seq++, + fprintf(tracefile,"%s,%d,%lu,%s,write_rand,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],fp->filename,fp->access_count); } } @@ -9033,9 +9071,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -9075,9 +9113,9 @@ } } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); #if defined(_solaris_) @@ -9252,9 +9290,9 @@ R_exit(114); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read,Read,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - (long long)fp->seqread_offset,trans,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,read,Read,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,(long long)fp->seqread_offset,trans,fp->access_count); #if defined(WIN32) largeoffset.QuadPart = 0; SetFilePointerEx(fd, largeoffset, &largeoffset, FILE_CURRENT); @@ -9285,9 +9323,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,read,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,read,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } if(!use_cached_fd) @@ -9382,9 +9420,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_file,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read_file,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -9425,9 +9463,9 @@ } } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_file,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read_file,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); #if defined(_solaris_) @@ -9602,9 +9640,9 @@ R_exit(114); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_file,Read file,%s,,%lld,%d,%ld,transferred=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - (long long)fp->wholefileread_offset,trans,fp->access_count,ret); + fprintf(tracefile,"%s,%d,%lu,%s,read_file,Read file,%s,,%lld,%d,%ld,transferred=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,(long long)fp->wholefileread_offset,trans,fp->access_count,ret); if(ret < trans) { fp->wholefileread_offset = 0; @@ -9650,8 +9688,8 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,read_file,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,read_file,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,fp->access_count); } } @@ -9735,9 +9773,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_rand,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read_rand,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -9776,9 +9814,9 @@ use_cached_fd = 1; } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_rand,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,read_rand,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -9997,8 +10035,8 @@ R_exit(116); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,read_rand,Random read,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,read_rand,Random read,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->offset,trans,fp->access_count); total_read_bytes += (double)(ret); total_read_rand_bytes+=(double)(ret); @@ -10029,9 +10067,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,read_rand,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,read_rand,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } if(!use_cached_fd) @@ -10117,9 +10155,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rmw,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,rmw,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); @@ -10160,9 +10198,9 @@ } } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rmw,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,rmw,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); #if defined(_solaris_) @@ -10345,8 +10383,8 @@ R_exit(116); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rmw,RMW read,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,rmw,RMW read,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->rmw_offset,trans,fp->access_count); total_rmw_bytes+=(double)(read_ret); total_file_ops += 1.0; /* Read */ @@ -10423,8 +10461,8 @@ R_exit(116); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rmw,RMW write,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,rmw,RMW write,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->rmw_offset,trans,fp->access_count); fp->op_count++; /* Read */ total_file_ops += 1.0; /* Write */ @@ -10465,9 +10503,9 @@ { I_FSYNC(fd); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rmw,Sync file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,rmw,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } if(!use_cached_fd) @@ -10479,9 +10517,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,rmw,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,rmw,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } } @@ -10569,8 +10607,8 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,stat,Stat,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,stat,Stat,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,fp->access_count); } work_obj[my_workload].stat_op_count++; @@ -10619,9 +10657,9 @@ } if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,chmod,Chmod,%s,0666,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,chmod,Chmod,%s,0666,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); } work_obj[my_workload].chmod_op_count++; total_file_ops += 1.0; @@ -10670,9 +10708,9 @@ R_exit(119); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Opendir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->dirname, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Opendir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->dirname,fp->access_count); /* Seek to random location within the directory */ seek_loc = netmist_rand()%client_files-1; @@ -10680,9 +10718,9 @@ /*seekdir(dp,(netmist_rand()%client_files-1));*/ ret = readdir(dp); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Readdir,%s,,%ld,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->dirname, - seek_loc,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Readdir,%s,,%ld,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->dirname,seek_loc,fp->access_count); if(ret < (struct dirent *)0) { c_eval=errno; @@ -10694,9 +10732,9 @@ } closedir(dp); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Closedir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->dirname, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Closedir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->dirname,fp->access_count); work_obj[my_workload].readdir_op_count++; total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; @@ -10744,15 +10782,15 @@ R_exit(119); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Opendir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],searchexpr, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Opendir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + searchexpr,fp->access_count); /* Seek to random location within the directory */ randomloc = netmist_rand()%client_files-1; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Readdir,%s,,%d,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],searchexpr, - randomloc,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Readdir,%s,,%d,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + searchexpr,randomloc,fp->access_count); /*simulate seekdir */ while (randomloc-- > 0) { @@ -10782,9 +10820,9 @@ FindClose(hFind); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,readdir,Closedir,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],searchexpr, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,readdir,Closedir,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + searchexpr,fp->access_count); work_obj[my_workload].readdir_op_count++; total_file_ops += 1.0; @@ -10832,9 +10870,9 @@ R_exit(120); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,access,Access,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,access,Access,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; work_obj[my_workload].access_op_count++; @@ -10880,9 +10918,9 @@ R_exit(121); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mkdir,Mkdir,%s,0777,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->dirname, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,mkdir,Mkdir,%s,0777,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->dirname,fp->access_count); total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; total_meta_ops += 1.0; @@ -10915,11 +10953,10 @@ fflush(newstdout); } ret=mkdir(dirname,0777); -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_dir,Mkdir,%s,0777,,,,\n", - client_id,trace_seq++,trace_states[tracestate],dirname); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_dir,Mkdir,%s,0777,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + dirname); return(ret); } @@ -11016,9 +11053,9 @@ R_exit(122); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,append,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d O_APPEND=1\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,append,Opened file,%s,0666,,,%ld,O_DIRECT=%d O_SYNC=%d O_APPEND=1\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); #if defined(_solaris_) @@ -11159,8 +11196,8 @@ R_exit(123); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,append,Write,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,append,Write,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->offset,trans,fp->access_count); total_file_ops += 1.0; /* Write/append */ work_obj[my_workload].total_file_ops+=1.0; /* Write/append */ @@ -11182,9 +11219,9 @@ { I_FSYNC(fd); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,append,Sync file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,append,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } if(lflag && flush_flag) I_FSYNC(fd); @@ -11195,9 +11232,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,append,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,append,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); } work_obj[my_workload].close_op_count++; total_write_bytes+=(double)(ret); @@ -11260,9 +11297,9 @@ if(ret == 0) { if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,unlink,Unlink,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,unlink,Unlink,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); work_obj[my_workload].unlink_op_count++; total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; @@ -11360,9 +11397,9 @@ if(fd > 0) { if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,create,Create,%s,0666,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,create,Create,%s,0666,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); work_obj[my_workload].create_op_count++; total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; @@ -11381,9 +11418,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,create,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,create,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); } } @@ -11408,9 +11445,9 @@ fflush(newstdout); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,locking,Calling lock_file(),%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,locking,Calling lock_file(),%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); ret=lock_file(fp->filename,fp); if(ret < 0) { @@ -11545,18 +11582,18 @@ my_size = stbuf.st_size; my_mode = stbuf.st_mode; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Stat,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Stat,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); /* If dest does not exist then start from beginning */ ret=I_STAT(alt_name, &stbuf); if(ret != 0) fp->copyfile_offset = 0; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Stat,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Stat,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + alt_name,fp->access_count); /* Open the input file */ #if defined(WIN32) @@ -11592,9 +11629,9 @@ } #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d O_RDONLY=1\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d O_RDONLY=1\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((iflags2 & 1)?1:0), ((iflags2 & 2)?1:0)); /* Seek to last known copyfile_offset */ @@ -11605,9 +11642,9 @@ I_LSEEK(fdi, fp->copyfile_offset, SEEK_SET); #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Seek,%s,,%lld,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - (long long)fp->copyfile_offset,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Seek,%s,,%lld,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,(long long)fp->copyfile_offset,fp->access_count); /* Now let's go the destination file */ #if defined(WIN32) fdo=CreateFile(alt_name, @@ -11643,9 +11680,9 @@ } #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d O_WRONLY=1\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d O_WRONLY=1\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + alt_name,fp->access_count, ((oflags2 & 1)?1:0), ((oflags2 & 2)?1:0)); #if defined(_solaris_) @@ -11694,9 +11731,9 @@ I_LSEEK(fdo, fp->copyfile_offset, SEEK_SET); #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Seek,%s,,%lld,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - (long long)fp->copyfile_offset,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Seek,%s,,%lld,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + alt_name,(long long)fp->copyfile_offset,fp->access_count); /* Now copy a chunk */ for(i=0;ifilename, - (long long)fp->copyfile_offset,CHUNK_SIZE,fp->access_count,read_ret); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Read chunk,%s,,%lld,%d,%ld,transferred=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,(long long)fp->copyfile_offset, + CHUNK_SIZE,fp->access_count,read_ret); #if defined(WIN32) err=WriteFile(fdo, copy_file_buf, read_ret, &write_ret, NULL); if((FALSE == err) || (write_ret <= 0)) @@ -11782,10 +11820,10 @@ } #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Write chunk,%s,,%lld,%d,%ld,transferred=%d\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - (long long)fp->copyfile_offset,CHUNK_SIZE, - fp->access_count,write_ret); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Write chunk,%s,,%lld,%d,%ld,transferred=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],alt_name,(long long)fp->copyfile_offset, + CHUNK_SIZE,fp->access_count,write_ret); fp->copyfile_offset += write_ret; write_transferred+=write_ret; @@ -11797,9 +11835,9 @@ fp->copyfile_offset = 0; unlink(alt_name); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Unlink,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Unlink,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],alt_name,fp->access_count); /*need a "break" statement here?? otherwise if the condition is satisfied in the first iteration, it will do the copy again*/ break; } @@ -11813,9 +11851,9 @@ { I_FSYNC(fdo); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,copyfile,Sync file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - alt_name,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Sync file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],alt_name,fp->access_count); } total_copyfile_bytes+=(double)((read_transferred+write_transferred)); @@ -11843,12 +11881,12 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,copyfile,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); - fprintf(tracefile,"%d,%lu,%s,copyfile,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],alt_name, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,copyfile,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + alt_name,fp->access_count); } total_file_ops += 2.0; /* Close */ work_obj[my_workload].total_file_ops+=2.0; /* Close */ @@ -11892,9 +11930,9 @@ if(ret == 0) { if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,rename,Rename,%s,,,,%ld,newname=%s\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count,alt_name); + fprintf(tracefile,"%s,%d,%lu,%s,rename,Rename,%s,,,,%ld,newname=%s\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count,alt_name); /* global (across all files in this work object) write count */ work_obj[my_workload].rename_op_count++; total_file_ops += 1.0; @@ -12014,9 +12052,9 @@ #endif #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,statfs,Statfs,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,statfs,Statfs,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); /* global (across all files in this work object) write count */ work_obj[my_workload].statfs_op_count++; @@ -12083,9 +12121,9 @@ } #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,pathconf,Pathconf,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,pathconf,Pathconf,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count); /* global (across all files in this work object) write count */ work_obj[my_workload].pathconf_op_count++; @@ -12180,8 +12218,9 @@ R_exit(126); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,lock_file,Opened file,%s,0666,,,%ld,\n",client_id, - trace_seq++,trace_states[tracestate],filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,lock_file,Opened file,%s,0666,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename,fp->access_count); /* Generic lock the whole file */ total_file_ops += 1.0; work_obj[my_workload].total_file_ops+=1.0; @@ -12259,8 +12298,9 @@ #endif fp->op_count++; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,lock_file,Lock,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,lock_file,Lock,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename,fp->access_count); total_file_ops += 1.0; /* fcntl */ work_obj[my_workload].total_file_ops+=1.0; /* fcntl */ @@ -12292,8 +12332,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,lock_file,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate],filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,lock_file,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename,fp->access_count); } total_file_ops += 1.0; /* Close */ work_obj[my_workload].total_file_ops+=1.0; /* Close */ @@ -12701,7 +12742,8 @@ printf("\t[-f name] ............. External monitor script name.\n"); printf("\t[-j args] ............. External monitor script arguments.\n"); printf("\t[-x ] ................. Enable socket debug.\n"); - printf("\t[-2 ] ................. Enable trace debug.\n"); + printf("\t[-2 #] ................ Enable trace debug: 0 = none, 1 = normal, 2 = init + normal.\n"); + printf("\t[-3 #] ................ Disable op validation.\n"); printf("\t[-h ] ................. Help menu.\n"); printf("\n"); printf("\tInternal use only. Do not use.\n"); @@ -13758,19 +13800,32 @@ } tmp_client_id= mc->m_client_number; + if(tmp_client_id == (num_clients -1)) + no_last_proc=1; res_obj = &client_obj[tmp_client_id].results; - if(sockdebug) + if(sockdebug || no_last_proc) { - printf("\t%s Master receiving results from Process %d\n",get_timestamp(&time_string[0]), - tmp_client_id); - fflush(stdout); + my_cur_time = gettime(); + if( sockdebug || ((my_cur_time - my_last_time) >= HEARTBEAT_TICK) ) + { + printf("\t%s Prime receiving results from child %d\n", + get_timestamp(&time_string[0]), tmp_client_id); + fflush(stdout); + if(log_flag) + { + fprintf(log_out,"\t%s Prime receiving results from child %d\n", + get_timestamp(&time_string[0]), tmp_client_id); + fflush(log_out); + } + my_last_time = my_cur_time; + } } strcpy(res_obj->client_name, mc->m_client_name); strcpy(res_obj->work_obj_name, mc->m_workload_name); - res_obj->work_obj_index = mc->m_work_obj_index; + res_obj->work_obj_index = mc->m_work_obj_index; res_obj->run_time = mc->m_run_time; res_obj->min_direct_size = mc->m_min_direct_size; res_obj->total_file_op_time = mc->m_total_file_op_time; @@ -13789,7 +13844,6 @@ for(u=0;ubands[u] = mc->m_bands[u]; - res_obj->read_count = mc->m_read_count; strcpy(res_obj->read_string, mc->m_read_string); @@ -14142,6 +14196,7 @@ cc.c_cleanup = cleanup_flag; cc.c_dump_files_flag = dump_files_flag; cc.c_tracedebug = tracedebug; + cc.c_do_validate = do_validate; cc.c_ipv6_enable = ipv6_enable; cc.c_licensed = licensed; cc.c_heartbeat = heartbeat_flag; @@ -14341,6 +14396,7 @@ cleanup_flag = cc->c_cleanup; dump_files_flag = cc->c_dump_files_flag; tracedebug = cc->c_tracedebug; + do_validate = cc->c_do_validate; ipv6_enable = cc->c_ipv6_enable; licensed = cc->c_licensed; heartbeat_flag = cc->c_heartbeat; @@ -16196,6 +16252,7 @@ sprintf(ecc->c_cleanup,"%d",cc->c_cleanup); sprintf(ecc->c_dump_files_flag,"%d",cc->c_dump_files_flag); sprintf(ecc->c_tracedebug,"%d",cc->c_tracedebug); + sprintf(ecc->c_do_validate,"%d",cc->c_do_validate); sprintf(ecc->c_ipv6_enable,"%d",cc->c_ipv6_enable); sprintf(ecc->c_licensed,"%d",cc->c_licensed); sprintf(ecc->c_heartbeat,"%d",cc->c_heartbeat); @@ -16255,6 +16312,7 @@ sscanf(ecc->c_cleanup,"%d",&cc->c_cleanup); sscanf(ecc->c_dump_files_flag,"%d",&cc->c_dump_files_flag); sscanf(ecc->c_tracedebug,"%d",&cc->c_tracedebug); + sscanf(ecc->c_do_validate,"%d",&cc->c_do_validate); sscanf(ecc->c_ipv6_enable,"%d",&cc->c_ipv6_enable); sscanf(ecc->c_licensed,"%d",&cc->c_licensed); sscanf(ecc->c_heartbeat,"%d",&cc->c_heartbeat); @@ -17909,9 +17967,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_write,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,mmap_write,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -17953,9 +18011,9 @@ } } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_write,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,mmap_write,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); total_file_ops +=1; @@ -18064,8 +18122,8 @@ fp->op_count++; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_write,Mmap write,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,mmap_write,Mmap write,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->mmapwrite_offset,trans, fp->access_count); /* global (across all files in this work object) write count */ @@ -18098,9 +18156,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,mmap_write,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,mmap_write,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } total_file_ops += 1.0; @@ -18146,9 +18204,9 @@ use_cached_fd = 1; fd = fp->file_desc; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_read,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,mmap_read,Using cached fd,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); } @@ -18191,9 +18249,9 @@ } } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_read,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", - client_id,trace_seq++,trace_states[tracestate],fp->filename, - fp->access_count, + fprintf(tracefile,"%s,%d,%lu,%s,mmap_read,Opened file,%s,,,,%ld,O_DIRECT=%d O_SYNC=%d\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], + fp->filename,fp->access_count, ((flags2 & 1)?1:0), ((flags2 & 2)?1:0)); total_file_ops +=1; @@ -18308,8 +18366,8 @@ fp->op_count++; if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,mmap_read,Mmap read,%s,,%lld,%d,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,mmap_read,Mmap read,%s,,%lld,%d,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,(long long)fp->mmapread_offset,trans,fp->access_count); /* global (across all files in this work object) wreadcount */ work_obj[my_workload].mmap_read_op_count++; @@ -18345,9 +18403,9 @@ #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,mmap_read,Closed file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], - fp->filename,fp->access_count); + fprintf(tracefile,"%s,%d,%lu,%s,mmap_read,Closed file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],fp->filename,fp->access_count); } } total_file_ops += 1.0; @@ -18615,9 +18673,9 @@ #endif /* Use virtualized, in case this function is workload specific */ if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,validate_ops,Make val dir,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate], - buf); + fprintf(tracefile,"%s,%d,%lu,%s,validate_ops,Make val dir,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],buf); ret=(*Netmist_Ops[my_workload].init_dir)(buf); if((ret < 0) && (errno != EEXIST)) { @@ -18647,8 +18705,8 @@ strcpy(fp->filename,buf); /* Create a file and fill it up with data */ if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,validate_ops,Create validate file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,validate_ops,Create validate file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,fp->access_count); } (*Netmist_Ops[my_workload].init_file)(buf,0,0,0); @@ -19194,8 +19252,8 @@ (*Netmist_Ops[my_workload].postfix_op)(x,fp); if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,validate_ops,Remove validate file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,validate_ops,Remove validate file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,fp->access_count); } (*Netmist_Ops[my_workload].remove_file)(fp->filename); @@ -19206,8 +19264,8 @@ else { if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,validate_ops,Remove validate file,%s,,,,%ld,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,validate_ops,Remove validate file,%s,,,,%ld,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], fp->filename,fp->access_count); } (*Netmist_Ops[my_workload].remove_file)(fp->filename); @@ -19222,8 +19280,8 @@ work_obj[my_workload].work_obj_name); #endif if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,validate_ops,Remove validate dir,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate], + fprintf(tracefile,"%s,%d,%lu,%s,validate_ops,Remove validate dir,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++,trace_states[tracestate], buf); } ret = (*Netmist_Ops[my_workload].remove_dir)(buf); @@ -19338,11 +19396,10 @@ if(init_phase) /* Just get the length set correctly */ { /* If the file doesn't exist, then skip to the create region. */ -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Stat,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Stat,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); #if defined(WIN32) ret = GetFileAttributes(filename); if(ret == INVALID_FILE_ATTRIBUTES) @@ -19394,11 +19451,10 @@ c_eflag++; R_exit(106); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Open,%s,0666,,,,O_APPEND=1", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Open,%s,0666,,,,O_APPEND=1", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); #if defined(WIN32) /* APPEND ... move file ponter to the EOF*/ largeoffset.QuadPart = 0; @@ -19409,11 +19465,10 @@ if(try_lock_file_hold(fd)==0) /* Got lock ? */ { I_STAT(filename, &stbuf); -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Stat,%s,,,,,\n",client_id,trace_seq++, + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Stat,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],filename); -#endif if(((long long)(stbuf.st_size)/(long long)1024) == (file_ptr->Original_fsize)) goto out; } @@ -19459,11 +19514,10 @@ #endif R_exit(107); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n",client_id,trace_seq++, + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],filename,i,max_xfer_size); -#endif if(init_phase) { post_time = gettime(); @@ -19532,23 +19586,21 @@ #endif R_exit(107); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n",client_id,trace_seq++, + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],filename, file_ptr->Original_fsize*1024-fringe,fringe); -#endif } #if defined(WIN32) CloseHandle(fd); #else close(fd); #endif -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,close,%s,,,,,\n",client_id,trace_seq++, + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,close,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, trace_states[tracestate],filename); -#endif purge_file(file_ptr,filename); return; } @@ -19565,12 +19617,11 @@ fflush(newstdout); } I_TRUNC(filename,(file_ptr->Original_fsize*(long long)1024)); -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,file_init,Truncate,%s,,,,,size=%lld\n", - client_id,trace_seq++,trace_states[tracestate], - filename,(file_ptr->Original_fsize*(long long)1024)); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,file_init,Truncate,%s,,,,,size=%lld\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename, + (file_ptr->Original_fsize*(long long)1024)); /* Just enough to break the caches. One op type has sufficient * files and space allocated to break the client's caches. * Reading more than this just consumes wall clock with no @@ -19652,22 +19703,20 @@ c_eflag++; R_exit(106); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Open,%s,0666,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Open,%s,0666,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); if(sharing_flag) /* In sharing mode, prevent dual writers */ { if(try_lock_file_hold(fd)==0) /* Got lock ? */ { /* Check to see if we have a collision in sharemode */ I_STAT(filename, &stbuf); -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Stat,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Stat,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); if(((long long)(stbuf.st_size)/(long long)1024) == (file_ptr->Original_fsize)) goto out; }else @@ -19739,12 +19788,10 @@ #endif R_exit(107); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", - client_id,trace_seq++,trace_states[tracestate],filename, - i,max_xfer_size); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename,i,max_xfer_size); if(init_phase) { post_time = gettime(); @@ -19821,12 +19868,11 @@ #endif R_exit(107); } -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", - client_id,trace_seq++,trace_states[tracestate],filename, + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Write,%s,,%lld,%d,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename, file_ptr->Original_fsize*1024-fringe,fringe); -#endif } /****/ if(cdebug) @@ -19839,11 +19885,10 @@ if(lflag && flush_flag) { I_FSYNC(fd); /* Not needed as it is not measured */ -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_file,Sync,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Sync,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); } total_file_ops += 1; work_obj[my_workload].total_file_ops+=1; @@ -19856,13 +19901,12 @@ #else close(fd); #endif -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) + if(tracedebug > 1) { - fprintf(tracefile,"%d,%lu,%s,init_file,Close,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); + fprintf(tracefile,"%s,%d,%lu,%s,init_file,Close,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); } -#endif } /* @@ -19925,11 +19969,10 @@ return; } #endif -#if defined(INIT_TRACE_DEBUG) - if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,init_empty_file,Create,%s,0666,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); -#endif + if(tracedebug > 1) + fprintf(tracefile,"%s,%d,%lu,%s,init_empty_file,Create,%s,0666,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); fprintf(newstdout,"%s ",get_timestamp(&time_string[0])); fprintf(newstdout,"Write empty file failed %s Error Value %d Error %s\n", filename, c_eval,err_str); @@ -20018,8 +20061,9 @@ } #endif if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,stat_workdir,Stat,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],workdir); + fprintf(tracefile,"%s,%d,%lu,%s,stat_workdir,Stat,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],workdir); return(ret); } @@ -20052,8 +20096,9 @@ fflush(newstdout); } if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,chdir,Chdir,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],dirname); + fprintf(tracefile,"%s,%d,%lu,%s,chdir,Chdir,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],dirname); return(ret); } @@ -20079,8 +20124,9 @@ } ret = unlink(filename); if(tracedebug) - fprintf(tracefile,"%d,%lu,%s,remove_file,Unlink,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],filename); + fprintf(tracefile,"%s,%d,%lu,%s,remove_file,Unlink,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],filename); return(ret); } @@ -20114,8 +20160,9 @@ } if(tracedebug) { - fprintf(tracefile,"%d,%lu,%s,remove_dir,Rmdir,%s,,,,,\n", - client_id,trace_seq++,trace_states[tracestate],dirname); + fprintf(tracefile,"%s,%d,%lu,%s,remove_dir,Rmdir,%s,,,,,\n", + get_timestamp(&time_string[0]),client_id,trace_seq++, + trace_states[tracestate],dirname); } return(ret); }