1c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak/* 2c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* Copyright (c) Bull S.A. 2007 All Rights Reserved. 3c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 4c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* This program is free software; you can redistribute it and/or modify it 5c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* under the terms of version 2 of the GNU General Public License as 6c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* published by the Free Software Foundation. 7c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 8c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* This program is distributed in the hope that it would be useful, but 9c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* WITHOUT ANY WARRANTY; without even the implied warranty of 10c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 12c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* Further, this software is distributed without any warranty that it is 13c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* free of the rightful claim of any third person regarding infringement 14c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* or the like. Any license provided herein, whether implied or 15c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* otherwise, applies only to this software file. Patent licenses, if 16c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* any, provided herein do not apply to combinations of this program with 17c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* other software, or any other product whatsoever. 18c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 19c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* You should have received a copy of the GNU General Public License along 20fed9641096e27f79a0f2d9adfe9839dd8d11dc0fWanlong Gao* with this program; if not, write the Free Software Foundation, Inc., 21fed9641096e27f79a0f2d9adfe9839dd8d11dc0fWanlong Gao* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 23c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* History: 24c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net) 25c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak* 262c28215423293e443469a07ae7011135d058b671Garrett Cooper*/ 27c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 28c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <stdio.h> 29c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <stdlib.h> 30c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <pthread.h> 31c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <time.h> 32c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <tirpc/netconfig.h> 33c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <tirpc/rpc/rpc.h> 34c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <tirpc/rpc/types.h> 35c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <tirpc/rpc/xdr.h> 36c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <tirpc/rpc/svc.h> 37c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#include <errno.h> 38c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 39c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak//Standard define 40c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#define PROCNUM 1 41c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#define VERSNUM 1 42c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 43c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak//Sys define 44c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak#define ADDRBUFSIZE 100 45c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 46c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakstatic double *thread_time_result; 47c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakstatic int maxThd = 1; 48c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakint run_mode; 49c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakint progNum; 50c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakint callNb; 51c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakchar *nettype = "visible"; 52c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modakchar *hostname; 53c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 54354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gaovoid *my_thread_process(void *arg) 55c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak{ 56c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak int i; 57354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao CLIENT *client = NULL; 58c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak struct netconfig *nconf = NULL; 59c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak struct netbuf svcaddr; 60354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao char addrbuf[ADDRBUFSIZE]; 61c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak int var_snd = 0; 622c28215423293e443469a07ae7011135d058b671Garrett Cooper int var_rec = -1; 63c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak struct timeval tv; 642c28215423293e443469a07ae7011135d058b671Garrett Cooper 65354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (run_mode == 1) { 667c7aeb5d8beb7b0d634d792e09893cc2206514f1subrata_modak fprintf(stderr, "Thread %d\n", atoi(arg)); 67c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 682c28215423293e443469a07ae7011135d058b671Garrett Cooper 69c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak tv.tv_sec = 0; 70c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak tv.tv_usec = 100; 71c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 72c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak nconf = getnetconfigent("udp"); 73cf0d626fe6224db3c714843dc7007e9f81d94a80Cyril Hrubis if (nconf == NULL) { 74c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //syslog(LOG_ERR, "getnetconfigent for udp failed"); 75c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak fprintf(stderr, "err nconf\n"); 76c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("5\n"); 77c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak exit(1); 78c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 79c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 80c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak svcaddr.len = 0; 81c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak svcaddr.maxlen = ADDRBUFSIZE; 82c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak svcaddr.buf = addrbuf; 832c28215423293e443469a07ae7011135d058b671Garrett Cooper 84354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (svcaddr.buf == NULL) { 85354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao /* if malloc() failed, print error messages and exit */ 86c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("5\n"); 87354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao exit(1); 88354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao } 89354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao //printf("svcaddr reserved (%s)\n", argc[1]); 902c28215423293e443469a07ae7011135d058b671Garrett Cooper 91354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (!rpcb_getaddr(progNum, VERSNUM, nconf, &svcaddr, hostname)) { 92354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao fprintf(stderr, "rpcb_getaddr failed!!\n"); 93c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("5\n"); 94354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao exit(1); 95354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao } 96354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao //printf("svc get\n"); 97c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 98c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak client = clnt_dg_create(RPC_ANYFD, &svcaddr, 99354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao progNum, VERSNUM, 1024, 1024); 1002c28215423293e443469a07ae7011135d058b671Garrett Cooper 101354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (client == NULL) { 102c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak clnt_pcreateerror("ERR"); 103c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("5\n"); 104c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak exit(1); 105c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 1062c28215423293e443469a07ae7011135d058b671Garrett Cooper 107354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (i = 0; i < callNb; i++) { 108c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak clnt_call(client, PROCNUM, 109354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (xdrproc_t) xdr_int, (char *)&var_snd, 110354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (xdrproc_t) xdr_int, (char *)&var_rec, tv); 111c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 1122c28215423293e443469a07ae7011135d058b671Garrett Cooper 113c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak clnt_destroy(client); 1142c28215423293e443469a07ae7011135d058b671Garrett Cooper 115354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao pthread_exit(0); 116c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak} 117c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak 1187c7aeb5d8beb7b0d634d792e09893cc2206514f1subrata_modakint main(int argn, char *argc[]) 119c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak{ 120c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Program parameters : argc[1] : HostName or Host IP 121354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao // argc[2] : Server Program Number 122354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao // argc[3] : Maximal number of threads 123354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao // argc[4] : Number of calls per thread 124354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao // other arguments depend on test case 1252c28215423293e443469a07ae7011135d058b671Garrett Cooper 126c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //run_mode can switch into stand alone program or program launch by shell script 127c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //1 : stand alone, debug mode, more screen information 128c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //0 : launch by shell script as test case, only one printf -> result status 129c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak run_mode = 0; 130354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao int test_status = 1; //Default test result set to FAILED 131aa19e0d71e2704407d353559f95a2231edb264eeCyril Hrubis int i; 1327c7aeb5d8beb7b0d634d792e09893cc2206514f1subrata_modak long j; 133c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak int threadNb = atoi((char *)argc[3]); 134354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao int curThd = 1; 1352c28215423293e443469a07ae7011135d058b671Garrett Cooper 136c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Thread declarations 137c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak pthread_t *pThreadArray; 138354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao void *ret = NULL; 139c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak pthread_attr_t thread_attr; 140c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak int ssz = 0; 1412c28215423293e443469a07ae7011135d058b671Garrett Cooper 142354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao //Time measurement declarations 143354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao struct timeval tv1, tv2; 144354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao struct timezone tz; 145354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao long long diff; 146354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao double rslt; 1472c28215423293e443469a07ae7011135d058b671Garrett Cooper 148354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao //Program initialization 149c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak progNum = atoi((char *)argc[2]); 150c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak callNb = atoi((char *)argc[4]); 151c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak hostname = (char *)argc[1]; 1522c28215423293e443469a07ae7011135d058b671Garrett Cooper 153c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Initialization 154c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak maxThd = maxThd << (threadNb - 1); //Set the maximum threads number 1552c28215423293e443469a07ae7011135d058b671Garrett Cooper 156354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao pthread_attr_init(&thread_attr); 1572c28215423293e443469a07ae7011135d058b671Garrett Cooper 158354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (run_mode == 1) { 159354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao pthread_attr_getstacksize(&thread_attr, (size_t *) & ssz); //For debug purpose, get default thread stack size 160c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak fprintf(stderr, "Server #%d\n", progNum); 161c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak fprintf(stderr, "Calls per thread : %d\n", callNb); 162c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak fprintf(stderr, "Instances : %d\n", threadNb); 163c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak fprintf(stderr, "Max threads to create : %d\n", maxThd); 164354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao fprintf(stderr, "Standard thread stack size in bytes %d\n", 165354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao ssz); 166c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 1672c28215423293e443469a07ae7011135d058b671Garrett Cooper 168354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao pthread_attr_setstacksize(&thread_attr, 40000); //Set thread stack size to 40 KB 1692c28215423293e443469a07ae7011135d058b671Garrett Cooper 170c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Init results table 171d218f348c12b42a78fa0306d9a033bfa4f67238bCyril Hrubis thread_time_result = malloc((threadNb) * sizeof(double)); 172c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak memset(&thread_time_result[0], (double)0, (threadNb) * sizeof(double)); 1732c28215423293e443469a07ae7011135d058b671Garrett Cooper 174c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Create all threads 175c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Run all threads 176d218f348c12b42a78fa0306d9a033bfa4f67238bCyril Hrubis pThreadArray = malloc(maxThd * sizeof(pthread_t)); 1772c28215423293e443469a07ae7011135d058b671Garrett Cooper 178354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (i = 0; i < threadNb; i++) { 179c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak if (run_mode) 180354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao fprintf(stderr, "Threads for pass %d : %d\n", i, 181354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao curThd); 1822c28215423293e443469a07ae7011135d058b671Garrett Cooper 183c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak gettimeofday(&tv1, &tz); 1842c28215423293e443469a07ae7011135d058b671Garrett Cooper 185354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (j = 0; j < curThd; j++) { 186c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Create thread using defined parameters (stack size = 40 KB) 187354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (pthread_create 188354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (&pThreadArray[j], &thread_attr, my_thread_process, 189354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (void *)j) != 0) { 190354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao fprintf(stderr, 191aa19e0d71e2704407d353559f95a2231edb264eeCyril Hrubis "pthread_create error for thread %ld\n", 192354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao j); 193354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao printf("1\n"); 194354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao exit(1); 195354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao } 196354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao } 1972c28215423293e443469a07ae7011135d058b671Garrett Cooper 198c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Clean threads 199354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (j = 0; j < curThd; j++) { 200354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if ((pthread_t *) pThreadArray[j] != NULL) { 201354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (void)pthread_join(pThreadArray[j], &ret); 202354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao } else { 203aa19e0d71e2704407d353559f95a2231edb264eeCyril Hrubis fprintf(stderr, "pThread Join Err : %ld\n", j); 204c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 205c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 2062c28215423293e443469a07ae7011135d058b671Garrett Cooper 207354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao gettimeofday(&tv2, &tz); 2082c28215423293e443469a07ae7011135d058b671Garrett Cooper 209354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao //Calculate and store delay to table results 210354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao diff = 211354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao (tv2.tv_sec - tv1.tv_sec) * 1000000L + (tv2.tv_usec - 212354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao tv1.tv_usec); 213c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak rslt = (double)diff / 1000; 214c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak thread_time_result[i] = rslt; 2152c28215423293e443469a07ae7011135d058b671Garrett Cooper 216354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao curThd = curThd * 2; 217c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 2182c28215423293e443469a07ae7011135d058b671Garrett Cooper 219c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Check if all threads results are ok 220c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak test_status = 0; 221354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (i = 0; i < threadNb; i++) { 222354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao if (thread_time_result[i] == 0) { 223c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak test_status = 1; 224c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak break; 225c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 226c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 2272c28215423293e443469a07ae7011135d058b671Garrett Cooper 228c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //This last printf gives the result status to the tests suite 229c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //normally should be 0: test has passed or 1: test has failed 230c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("%d\n", test_status); 2312c28215423293e443469a07ae7011135d058b671Garrett Cooper 232c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak //Print scalability results 233c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak curThd = 1; 234354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao for (i = 0; i < threadNb; i++) { 235c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak printf("%d %lf\n", curThd, thread_time_result[i]); 236c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak curThd = curThd * 2; 237c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak } 2382c28215423293e443469a07ae7011135d058b671Garrett Cooper 239c0caf8f23e4c43743fcac7e5a308d085b2f09107subrata_modak return test_status; 240ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman} 241