|
From: Peter C. <pc...@us...> - 2010-03-04 00:19:02
|
Update of /cvsroot/ipbench/ipbench2/src/tests/nfsstone In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14456/src/tests/nfsstone Modified Files: nfsstones.c Log Message: New version: nfsstone should now work, and I've actually tested the XML parsing this time... Index: nfsstones.c =================================================================== RCS file: /cvsroot/ipbench/ipbench2/src/tests/nfsstone/nfsstones.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** nfsstones.c 3 Feb 2010 01:26:51 -0000 1.15 --- nfsstones.c 4 Mar 2010 00:18:41 -0000 1.16 *************** *** 12,16 **** #include <sys/utsname.h> ! /* * This program has been modified to extend the ipbench, benchmark * framework. The original code base has been kept and resturctured --- 12,16 ---- #include <sys/utsname.h> ! /* * This program has been modified to extend the ipbench, benchmark * framework. The original code base has been kept and resturctured *************** *** 20,24 **** * main()->nfsstone_start() */ ! /* * This program takes two arguments. The first one is the directory to --- 20,24 ---- * main()->nfsstone_start() */ ! /* * This program takes two arguments. The first one is the directory to *************** *** 99,103 **** double ustos(uint64_t usec) ! { double tmp = usec/1000000.0; return tmp; --- 99,103 ---- double ustos(uint64_t usec) ! { double tmp = usec/1000000.0; return tmp; *************** *** 147,151 **** char *tmp_top_dirs, *tmp_bot_dirs; char *err_buf; /* error buffer for strtol() */ ! if(strncmp(version,"1.0", 256) == 0){ fprintf(stderr, "/****************************************************/\n"); --- 147,151 ---- char *tmp_top_dirs, *tmp_bot_dirs; char *err_buf; /* error buffer for strtol() */ ! if(strncmp(version,"1.0", 256) == 0){ fprintf(stderr, "/****************************************************/\n"); *************** *** 167,180 **** } strncpy(tmp,arg,STR_LEN); ! if (hostname == NULL){ fprintf(stderr, "nfsstone_setup called with hostname = NULL\n"); } dbprintf("[%d][nfsstone_setup] called with: hostname[%s], port[%d], arg[%s]\n", ! __LINE__,hostname, port, tmp); ! strncpy(path,strtok(tmp, " \t\n"),STR_LEN); strncpy(lock,strtok(NULL, " \t\n"),STR_LEN); ! if( (tmp_top_dirs=strtok(NULL," \t\n")) != NULL ){ top_dirs=strtol(tmp_top_dirs,&err_buf,0); --- 167,180 ---- } strncpy(tmp,arg,STR_LEN); ! if (hostname == NULL){ fprintf(stderr, "nfsstone_setup called with hostname = NULL\n"); } dbprintf("[%d][nfsstone_setup] called with: hostname[%s], port[%d], arg[%s]\n", ! __LINE__,hostname, port, tmp); ! strncpy(path,strtok(tmp, " \t\n"),STR_LEN); strncpy(lock,strtok(NULL, " \t\n"),STR_LEN); ! if( (tmp_top_dirs=strtok(NULL," \t\n")) != NULL ){ top_dirs=strtol(tmp_top_dirs,&err_buf,0); *************** *** 185,189 **** } } ! if( (tmp_bot_dirs=strtok(NULL," \t\n")) != NULL ){ bot_dirs=strtol(tmp_bot_dirs,&err_buf,0); --- 185,189 ---- } } ! if( (tmp_bot_dirs=strtok(NULL," \t\n")) != NULL ){ bot_dirs=strtol(tmp_bot_dirs,&err_buf,0); *************** *** 194,198 **** } } ! dbprintf("[%d][nfsstone_setup]path[%s] lock [%s]\n\tTOP_DIRS[%ld], BOT_DIRS[%ld]\n", __LINE__,path, lock, top_dirs, bot_dirs); --- 194,198 ---- } } ! dbprintf("[%d][nfsstone_setup]path[%s] lock [%s]\n\tTOP_DIRS[%ld], BOT_DIRS[%ld]\n", __LINE__,path, lock, top_dirs, bot_dirs); *************** *** 223,227 **** return FAIL; } ! /* * Now we go get the lock to synchronise with the other clients --- 223,227 ---- return FAIL; } ! /* * Now we go get the lock to synchronise with the other clients *************** *** 247,253 **** struct stat stat_buf; int error=OK; ! gettimeofday(stop,NULL); ! if (stat(path, &stat_buf) != OK) { perror("path_prefix"); --- 247,253 ---- struct stat stat_buf; int error=OK; ! gettimeofday(stop,NULL); ! if (stat(path, &stat_buf) != OK) { perror("path_prefix"); *************** *** 276,282 **** int nfsstone_marshall(char **data, int *size, double running_time) { ! data = malloc(sizeof(results)); ! memcpy(data, &results, sizeof(results)); *size = sizeof(results) + 1; return OK; } --- 276,286 ---- int nfsstone_marshall(char **data, int *size, double running_time) { ! *data = malloc(sizeof(results)); ! ! // ASSERT(*data); ! ! memcpy(*data, &results, sizeof(results)); *size = sizeof(results) + 1; + return OK; } *************** *** 291,305 **** char *res = malloc(input_len); dbprintf("[%d][nfsstone_unmarshall]\n",__LINE__); - ! if(res!=NULL){ ! *data = res; ! memcpy(res, input, input_len); ! *data_len = input_len; ! } ! else{ fprintf(stderr,"[%d][nfsstone_unmarshall]Received bad data oops.\n", __LINE__); return FAIL; } return OK; } --- 295,308 ---- char *res = malloc(input_len); dbprintf("[%d][nfsstone_unmarshall]\n",__LINE__); ! if (res == NULL){ fprintf(stderr,"[%d][nfsstone_unmarshall]Received bad data oops.\n", __LINE__); return FAIL; } + + *data = res; + memcpy(res, input, input_len); + *data_len = input_len; + return OK; } *************** *** 310,313 **** --- 313,317 ---- return; } + int nfsstone_output(struct client_data data[], int nelem) { *************** *** 317,333 **** uint64_t stones_equal[nelem]; /* make sure the work loads were equal */ uint64_t avg_total_time=0; ! ! for(i=0; i < nelem; i++){ ! res=(struct nfsstone_results *)(data[i].data); ! if(res != NULL){ int j; uint64_t c_stones, c_run_time; ! ! for(j=0;j<i;j++){ ! /* * here we check to see that the loads are equal * I see no point in benchmarking unequal loads. */ ! if( stones_equal[j] != ntohll(res->total_stones) ){ struct nfsstone_results *tmp=(struct nfsstone_results *)(data[j].data); printf("========= Invalid results =========\n"); --- 321,337 ---- uint64_t stones_equal[nelem]; /* make sure the work loads were equal */ uint64_t avg_total_time=0; ! ! for (i=0; i < nelem; i++){ ! res = (struct nfsstone_results *)(data[i].data); ! if (res != NULL) { int j; uint64_t c_stones, c_run_time; ! ! for (j=0; j<i; j++){ ! /* * here we check to see that the loads are equal * I see no point in benchmarking unequal loads. */ ! if (stones_equal[j] != ntohll(res->total_stones)) { struct nfsstone_results *tmp=(struct nfsstone_results *)(data[j].data); printf("========= Invalid results =========\n"); *************** *** 336,351 **** } } ! c_stones = ntohll(res->total_stones); c_run_time = ntohll(res->usec); stones_equal[i] = c_stones; avg_total_time += c_run_time; ! printf("Nfsstone results for: %s\n", res->host); printf("Total Nfsstones Total Time Seconds Nfsstone/Second\n"); printf("%15"PRIu64"%22.5f%19.5f\n", c_stones, ustos(c_run_time), c_stones/ustos(c_run_time) ); ! } ! else{ printf("nfsstone client data results are NULL\n"); } --- 340,354 ---- } } ! c_stones = ntohll(res->total_stones); c_run_time = ntohll(res->usec); stones_equal[i] = c_stones; avg_total_time += c_run_time; ! printf("Nfsstone results for: %s\n", res->host); printf("Total Nfsstones Total Time Seconds Nfsstone/Second\n"); printf("%15"PRIu64"%22.5f%19.5f\n", c_stones, ustos(c_run_time), c_stones/ustos(c_run_time) ); ! } else { printf("nfsstone client data results are NULL\n"); } *************** *** 357,360 **** --- 360,364 ---- printf(" Std. Dev.\n"); printf( "%20.5f\n", ustos(std_dev(data,avg_total_time,nelem)) ); + return OK; } *************** *** 364,368 **** struct timeval end_time; int error = 0; ! error = nfsstone_run(start, &end_time); dbprintf("[%d][nfsstone_start] returning error[%d]\n", __LINE__, error); --- 368,372 ---- struct timeval end_time; int error = 0; ! error = nfsstone_run(start, &end_time); dbprintf("[%d][nfsstone_start] returning error[%d]\n", __LINE__, error); *************** *** 371,375 **** /* ! * This level of indirection is required due to the fact the we fork. * Ipbench only expects ONE return value not a whole bunch so just * return once from here after all children or errors are accounted for. --- 375,379 ---- /* ! * This level of indirection is because we fork. * Ipbench only expects ONE return value not a whole bunch so just * return once from here after all children or errors are accounted for. *************** *** 377,389 **** int nfsstone_run(struct timeval *start, struct timeval *end_time) { ! struct timezone dummy; char hostname[BUFSIZ]; ! int i, j, num = 0, status; pid_t pid=0; char s[BUFSIZ], t[BUFSIZ], u[BUFSIZ]; int error = OK; ! /* Do not include getting host name in * timming calcs, this would be wrong!!! --- 381,393 ---- int nfsstone_run(struct timeval *start, struct timeval *end_time) { ! struct timezone dummy; char hostname[BUFSIZ]; ! int i, j, num = 0, status; pid_t pid=0; char s[BUFSIZ], t[BUFSIZ], u[BUFSIZ]; int error = OK; ! /* Do not include getting host name in * timming calcs, this would be wrong!!! *************** *** 395,401 **** error += FAIL; } ! dbprintf("Using hostname[%s]\n", hostname); ! /* * Start Timing --- 399,405 ---- error += FAIL; } ! dbprintf("Using hostname[%s]\n", hostname); ! /* * Start Timing *************** *** 405,414 **** error += FAIL; } ! for (i = 0; i < TOP_DIRS; i++) { /* dont even think of starting if already in error */ if(error) break; ! (void)sprintf(u, "%8d-%s", ++num, hostname); dbprintf("[%d][nfsstone_run]Makeing directory '%s'\n", __LINE__, u); --- 409,418 ---- error += FAIL; } ! for (i = 0; i < TOP_DIRS; i++) { /* dont even think of starting if already in error */ if(error) break; ! (void)sprintf(u, "%8d-%s", ++num, hostname); dbprintf("[%d][nfsstone_run]Makeing directory '%s'\n", __LINE__, u); *************** *** 441,445 **** } } ! while( (pid=wait(&status)) != -1) if (WEXITSTATUS(status) != OK) --- 445,449 ---- } } ! while( (pid=wait(&status)) != -1) if (WEXITSTATUS(status) != OK) *************** *** 481,485 **** strncpy(results.host, hostname, STR_LEN); results.total_stones=htonll((long)TOTAL_OPS); ! results.usec = htonll(stous((end_time->tv_sec - start->tv_sec)) + (end_time->tv_usec - start->tv_usec)); dbprintf("usec[%"PRIu64"]\n", results.usec); --- 485,489 ---- strncpy(results.host, hostname, STR_LEN); results.total_stones=htonll((long)TOTAL_OPS); ! results.usec = htonll(stous((end_time->tv_sec - start->tv_sec)) + (end_time->tv_usec - start->tv_usec)); dbprintf("usec[%"PRIu64"]\n", results.usec); *************** *** 496,500 **** dbprintf("[%d][nfsstone do_child]\n", __LINE__); ! if (chdir(dir) != OK) { dbprintf("Could not chdir(%s)\n", dir); --- 500,504 ---- dbprintf("[%d][nfsstone do_child]\n", __LINE__); ! if (chdir(dir) != OK) { dbprintf("Could not chdir(%s)\n", dir); *************** *** 517,521 **** * Now lets through in some readlink calls */ ! if (symlink("/aaa/bbb/ccc/ddd/eee/fff", "Test_link") != OK) { perror("symlink"); --- 521,525 ---- * Now lets through in some readlink calls */ ! if (symlink("/aaa/bbb/ccc/ddd/eee/fff", "Test_link") != OK) { perror("symlink"); |