From: Luke M. <lu...@us...> - 2005-08-04 05:09:12
|
Update of /cvsroot/ipbench/ipbench2/src/tests/nfs_latency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27316/src/tests/nfs_latency Modified Files: nfs_latency.c Log Message: I don't know. Index: nfs_latency.c =================================================================== RCS file: /cvsroot/ipbench/ipbench2/src/tests/nfs_latency/nfs_latency.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nfs_latency.c 27 Jun 2005 04:23:22 -0000 1.4 --- nfs_latency.c 4 Aug 2005 05:09:03 -0000 1.5 *************** *** 31,34 **** --- 31,37 ---- } + uint64_t* sample; + int nfs_latency_finished = 0; + /* * Start your test -- timestamp start with gettimeofday() as the last *************** *** 39,46 **** nfs_latency_start (struct timeval *start) { ! int samples=0; int target=1000; int r; ! uint64_t now, then, delta; dbprintf("NFS_LATENCY START\n"); --- 42,49 ---- nfs_latency_start (struct timeval *start) { ! int i=0; int target=1000; int r; ! uint64_t now, then; dbprintf("NFS_LATENCY START\n"); *************** *** 48,59 **** dbprintf("NFS latency start,\n"); ! while(samples<target){ now = time_stamp(); r = generate_request(now); ! r = process_reply(&then); ! delta = now - then; ! dbprintf("delta = %ld\n", delta); } dbprintf("NFS latency test complete.\n"); return 0; --- 51,73 ---- dbprintf("NFS latency start,\n"); ! if(nfs_latency_finished==0){ ! /* allocate memory for samples */ ! sample = malloc(sizeof(uint64_t) * target); ! }else{ ! /* re-use old samples */ ! nfs_latency_finished = 0; ! } ! ! while(i<target){ now = time_stamp(); r = generate_request(now); ! if(process_reply(&then)==0){ ! sample[i] = now - then; ! dbprintf("delta = %ld\n", sample[i]); ! i++; ! } } + nfs_latency_finished = 1; dbprintf("NFS latency test complete.\n"); return 0; *************** *** 86,110 **** nfs_latency_marshall (char **data, int * size, double running_time) { ! char *ok_string = "You have successfully called the nfs_latency test!"; ! char *not_ok_string = "You have unsuccessfully called the nfs_latency test!\n"; dbprintf("NFS_LATENCY MARSHALL\n"); ! /* We randomly fail this */ ! srand(time(NULL)); ! int j = 1 + (int)(10.0 * rand()/(RAND_MAX + 1.0));; ! ! if (j % 2) { ! dbprintf("Test Passed!\n"); *data = ok_string; ! } else { ! dbprintf("Test Failed!\n"); ! *data = not_ok_string; ! } ! ! *size = strlen (*data) + 1; ! if (j % 2) return 0; ! return 1; } --- 100,118 ---- nfs_latency_marshall (char **data, int * size, double running_time) { ! char *ok_string = "nfs_latency succeeded\n"; ! char *not_ok_string = "nfs_latency failed\n"; dbprintf("NFS_LATENCY MARSHALL\n"); ! if(nfs_latency_finished==1){ ! dbprintf("test was finished\n"); *data = ok_string; ! *size = strlen(*data) + 1; return 0; ! } ! /* else */ ! dbprintf("test was not finished\n"); ! *data = not_ok_string; ! *size = strlen(*data) + 1; return 1; } *************** *** 133,137 **** int nfs_latency_unmarshall(char *input, int input_len, char **data, ! int * data_len) { char *buf = malloc (input_len); --- 141,145 ---- int nfs_latency_unmarshall(char *input, int input_len, char **data, ! int *data_len) { char *buf = malloc (input_len); |