From: Zdeněk Šustr Date: Fri, 25 Jun 2010 14:34:16 +0000 (+0000) Subject: Poor man's extension of the period covered by statistics. X-Git-Tag: glite-security-gsoap-plugin_R_2_1_2_1~7 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=f21a8308eb5a9860bc944ec712607403c6930f69;p=jra1mw.git Poor man's extension of the period covered by statistics. --- diff --git a/org.glite.lb.client/examples/stats.c b/org.glite.lb.client/examples/stats.c index 82cab20..14e273a 100644 --- a/org.glite.lb.client/examples/stats.c +++ b/org.glite.lb.client/examples/stats.c @@ -33,27 +33,37 @@ int main(int argc,char **argv) edg_wll_QueryRec group[2]; time_t now,from,to; char *cfrom,*cto; - int from_res,to_res; + int from_res,to_res,argOK = 3, era = 60; float val; + int CEidx = 1, MAJidx = 2, MINidx = 3; edg_wll_InitContext(&ctx); - if (argc < 3) { - fprintf(stderr,"usage: %s CE major [minor]\n",argv[0]); + if (!strcmp(argv[1],"-n")) { + era = atoi(argv[2]); + CEidx = 3; MAJidx = 4; MINidx = 5; + argOK = 5; + } + + + if (argc < argOK) { + fprintf(stderr,"usage: %s [-n sec] CE major [minor]\n",argv[0]); return 1; } + + /* the only supported grouping for now */ group[0].attr = EDG_WLL_QUERY_ATTR_DESTINATION; group[0].op = EDG_WLL_QUERY_OP_EQUAL; - group[0].value.c = argv[1]; + group[0].value.c = argv[CEidx]; group[1].attr = EDG_WLL_QUERY_ATTR_UNDEF; time(&now); to = now; - from = now - 60; + from = now - (time_t)era; /* not implemented yet if (edg_wll_StateDuration(ctx,group,EDG_WLL_JOB_SCHEDULED,0, @@ -73,14 +83,14 @@ int main(int argc,char **argv) printf("Average queue traversal time at \"%s\": %f s\n" " Measuered from %s to %s\n" " With resolution from %d to %d s\n", - argv[1],val,cfrom,cto,from_res,to_res); + argv[CEidx],val,cfrom,cto,from_res,to_res); */ to = now; from = now - 60; - if (edg_wll_StateRate(ctx,group,atoi(argv[2]),argc >=4 ? atoi(argv[3]) : 0, + if (edg_wll_StateRate(ctx,group,atoi(argv[MAJidx]),argc >= (argOK+1) ? atoi(argv[MINidx]) : 0, &from,&to,&val,&from_res,&to_res)) { char *et,*ed; @@ -97,7 +107,7 @@ int main(int argc,char **argv) printf("Average failure rate at \"%s\": %f jobs/s\n" " Measuered from %s to %s\n" " With resolution from %d to %d s\n", - argv[1],val,cfrom,cto,from_res,to_res); + argv[CEidx],val,cfrom,cto,from_res,to_res); return 0; }