From 46797f1e3053fd08360d26a32de24c944b503331 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Mon, 1 Jun 2009 08:52:01 +0000 Subject: [PATCH] collection handling in performance testing --- org.glite.lb.common/src/lb_perftest.c | 23 ++++++++++++++--------- org.glite.lb.common/src/perftest_common.sh | 15 +++++++++++++++ org.glite.lb.logger/src/perftest_il.sh | 2 +- org.glite.lb.logger/src/perftest_ll.sh | 2 +- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/org.glite.lb.common/src/lb_perftest.c b/org.glite.lb.common/src/lb_perftest.c index 7c3607c..e85caae 100644 --- a/org.glite.lb.common/src/lb_perftest.c +++ b/org.glite.lb.common/src/lb_perftest.c @@ -218,6 +218,7 @@ read_events(int fd) nsubjobs = val; subjobids = realloc(subjobids, (nsubjobs+1)*sizeof(*subjobids)); if(subjobids == NULL) goto nomem; + memset(subjobids, 0, (nsubjobs+1)*sizeof(*subjobids)); } } else { /* some other key */ @@ -310,7 +311,8 @@ glite_wll_perftest_init(const char *host, close(fd); fprintf(stderr, "PERFTEST_JOB_SIZE=%d\n", nevents); - fprintf(stderr, "PERFTEST_NUM_JOBS=%d\n", njobs * (nsubjobs + 1)); + fprintf(stderr, "PERFTEST_NUM_JOBS=%d\n", njobs); + fprintf(stderr, "PERFTEST_NUM_SUBJOBS=%d\n", nsubjobs); } /* we suppose nsubjobs was filled in by read_events() */ @@ -340,7 +342,6 @@ glite_wll_perftest_init(const char *host, fprintf(stderr, "produceJobId: error unparsing jobid\n"); return(-1); } - glite_jobid_free(jobid); /* generate subjob ids */ if(nsubjobs > 0) { @@ -351,12 +352,13 @@ glite_wll_perftest_init(const char *host, } } for(i = 1; i <= nsubjobs; i++) { - if((jobids[n*(nsubjobs+1) + i] = edg_wlc_JobIdUnparse(subjobid[i])) == NULL) { + if((jobids[n*(nsubjobs+1) + i] = edg_wlc_JobIdUnparse(subjobid[i-1])) == NULL) { fprintf(stderr, "produceJobId: error unparsing jobid\n"); return(-1); } glite_jobid_free(subjobid[i]); } + glite_jobid_free(jobid); } @@ -406,7 +408,7 @@ glite_wll_perftest_produceEventString(char **event, char **jobid) { static int first = 1; char *e; - int len, cur_subjob; + int len, cur_subjob, jobi; assert(event != NULL); @@ -423,8 +425,11 @@ glite_wll_perftest_produceEventString(char **event, char **jobid) /* use index to get current subjob */ cur_subjob = events[cur_event].job_index; + /* current job index */ + jobi = cur_group*group_size + cur_job; + /* did we send all events? */ - if(cur_group*group_size + cur_job > njobs) { + if(jobi > njobs) { /* construct termination event */ if((len=trio_asprintf(&e, EDG_WLL_FORMAT_COMMON EDG_WLL_FORMAT_USERTAG "\n", @@ -435,7 +440,7 @@ glite_wll_perftest_produceEventString(char **event, char **jobid) "UserInterface", /* source */ "me again", /* source instance */ "UserTag", /* event */ - jobids[cur_job], /* jobid */ + jobids[jobi], /* jobid */ "UI=999980:NS=9999999980:WM=999980:BH=9999999980:JSS=999980:LM=999980:LRMS=999980:APP=999980", /* sequence */ PERFTEST_END_TAG_NAME, PERFTEST_END_TAG_VALUE)) < 0) { @@ -467,8 +472,8 @@ glite_wll_perftest_produceEventString(char **event, char **jobid) /* return current event with jobid filled in */ if((len=trio_asprintf(&e, "DG.JOBID=\"%s\" DG.REGJOB.PARENT=\"%s\" DG.REGJOB.SEED=\"%s\" DG.REGJOB.NSUBJOBS=\"%d\" %s", - jobids[cur_job*(nsubjobs+1) + cur_subjob], - (nsubjobs > 0) ? jobids[cur_job*(nsubjobs+1)] : "", + jobids[jobi*(nsubjobs+1) + cur_subjob], + (nsubjobs > 0) ? jobids[jobi*(nsubjobs+1)] : "", test_name, nsubjobs, events[cur_event].event)) < 0) { @@ -477,7 +482,7 @@ glite_wll_perftest_produceEventString(char **event, char **jobid) abort(); return(-1); } - *jobid = jobids[cur_job*(nsubjobs+1) + cur_subjob]; + *jobid = jobids[jobi*(nsubjobs+1) + cur_subjob]; /* advance to the next job and/or event */ if(++cur_job % group_size == 0) { diff --git a/org.glite.lb.common/src/perftest_common.sh b/org.glite.lb.common/src/perftest_common.sh index 5eb420a..e110d2c 100644 --- a/org.glite.lb.common/src/perftest_common.sh +++ b/org.glite.lb.common/src/perftest_common.sh @@ -7,9 +7,15 @@ if [[ -z $JOB_FILE ]] then JOB_FILE[0]=$STAGEDIR/examples/perftest/perf_simple_avg_events.log + JOB_DESC[0]="avg_job" JOB_FILE[1]=$STAGEDIR/examples/perftest/perf_simple_max_events.log + JOB_DESC[1]="big_job" JOB_FILE[2]=$STAGEDIR/examples/perftest/perf_dag_avg_events.log + JOB_DESC[2]="avg_dag" JOB_FILE[3]=$STAGEDIR/examples/perftest/perf_dag_max_events.log + JOB_DESC[3]="big_dag" + JOB_FILE[4]=$STAGEDIR/examples/perftest/perf_collection_avg_events.log + JOB_DESC[4]="collection" fi # path to the job event producer @@ -75,6 +81,15 @@ init_result() done } +print_result_header() +{ + for desc in ${JOB_DESC[*]} + do + printf " %14s " $desc + done + #echo -e "\tavg_job \t big_job \t avg_dag \t big_dag" +} + print_result() { for res in ${PERFTEST_THROUGHPUT[*]} diff --git a/org.glite.lb.logger/src/perftest_il.sh b/org.glite.lb.logger/src/perftest_il.sh index e9d2ee5..31bd771 100644 --- a/org.glite.lb.logger/src/perftest_il.sh +++ b/org.glite.lb.logger/src/perftest_il.sh @@ -344,7 +344,7 @@ do echo -n "Your choice: " read -e TEST_VARIANT done - echo -e "\tavg_job \t big_job \t avg_dag \t big_dag" + print_result_header fi if [[ "x$TEST_VARIANT" = "x*" ]] diff --git a/org.glite.lb.logger/src/perftest_ll.sh b/org.glite.lb.logger/src/perftest_ll.sh index d6fc67d..5ce73ff 100644 --- a/org.glite.lb.logger/src/perftest_ll.sh +++ b/org.glite.lb.logger/src/perftest_ll.sh @@ -114,7 +114,7 @@ then echo -n "Your choice: " read -e TEST_VARIANT done - echo -e "\tavg_job \t big_job \t avg_dag \t big_dag" + print_result_header fi if [[ "x$TEST_VARIANT" = "x*" ]] -- 1.8.2.3