From: Jiří Filipovič Date: Mon, 21 Jun 2010 11:07:52 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: glite-lb-types_R_1_1_1_1_emi_0~17 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=3fcbaff73b8681f46012b1eab9d9810bc34fcec6;p=jra1mw.git *** empty log message *** --- diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index d6d2a52..db50edc 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -140,7 +140,7 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la TOOLS:=${LB_PERF_TOOLS} -EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c test_changed_jdl.c done_failed_events.c +EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c query_ext.c query_seq_code.c stats.c stats-duration-fromto.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c test_changed_jdl.c done_failed_events.c EXAMPLES:=${EXAMPLES_SRC:.c=} # TODO: migrate them here from branch_RC31_3 diff --git a/org.glite.lb.client/interface/statistics.h b/org.glite.lb.client/interface/statistics.h index e7c8342..e07a7ca 100644 --- a/org.glite.lb.client/interface/statistics.h +++ b/org.glite.lb.client/interface/statistics.h @@ -68,7 +68,18 @@ int edg_wll_StateDuration( int *res_to ); - +int edg_wll_StateDurationFromTo( + edg_wll_Context ctx, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode base, + edg_wll_JobStatCode final, + int *minor, + time_t *from, + time_t *to, + float *duration, + int *res_from, + int *res_to +); #ifdef __cplusplus } diff --git a/org.glite.lb.client/src/statistics.c b/org.glite.lb.client/src/statistics.c index 3eec328..1f808ff 100644 --- a/org.glite.lb.client/src/statistics.c +++ b/org.glite.lb.client/src/statistics.c @@ -66,7 +66,7 @@ int edg_wll_StateRate( edg_wll_ResetError(ctx); - edg_wll_StatsRequestToXML(ctx, "Rate", group, major, minor, from, to, &send_mess); + edg_wll_StatsRequestToXML(ctx, "Rate", group, major, EDG_WLL_JOB_UNDEF, minor, from, to, &send_mess); if (set_server_name_and_port(ctx, NULL)) goto err; @@ -112,7 +112,7 @@ int edg_wll_StateDuration( edg_wll_ResetError(ctx); - edg_wll_StatsRequestToXML(ctx, "Duration", group, major, minor, from, to, &send_mess); + edg_wll_StatsRequestToXML(ctx, "Duration", group, major, EDG_WLL_JOB_UNDEF, minor, from, to, &send_mess); if (set_server_name_and_port(ctx, NULL)) goto err; @@ -138,6 +138,54 @@ err: +/** Compute average time for which jobs moves from one to second specified state. + */ + +int edg_wll_StateDurationFromTo( + edg_wll_Context ctx, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode base, + edg_wll_JobStatCode final, + int *minor, + time_t *from, + time_t *to, + float *duration, + int *res_from, + int *res_to +) +{ + char *response = NULL, *send_mess = NULL, *message = NULL; + float not_returned; + + + edg_wll_ResetError(ctx); + + edg_wll_StatsRequestToXML(ctx, "DurationFromTo", group, base, final, minor, from, to, &send_mess); + + if (set_server_name_and_port(ctx, NULL)) + goto err; + + ctx->p_tmp_timeout = ctx->p_query_timeout; + + if (edg_wll_http_send_recv(ctx, "POST /statsRequest HTTP/1.1",request_headers, send_mess, + &response,NULL,&message)) + goto err; + + if (http_check_status(ctx,response)) + goto err; + + edg_wll_ParseStatsResult(ctx,message, from, to, ¬_returned, + duration, res_from, res_to); + +err: + free(response); + free(message); + + return edg_wll_Error(ctx,NULL,NULL); +} + + + static int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_conditions) { int i = 0, j,