From: Jiří Filipovič Date: Tue, 13 Jul 2010 14:57:08 +0000 (+0000) Subject: divided edg_wll_State* to ensure backward compatibility X-Git-Tag: glite-jobid-api-c_R_1_0_5_1~22 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=5d284dfc4e73f455f4870a300edec5631039b1b1;p=jra1mw.git divided edg_wll_State* to ensure backward compatibility --- diff --git a/org.glite.lb.client/examples/stats-duration-fromto.c b/org.glite.lb.client/examples/stats-duration-fromto.c index 3682284..62f1eb2 100644 --- a/org.glite.lb.client/examples/stats-duration-fromto.c +++ b/org.glite.lb.client/examples/stats-duration-fromto.c @@ -59,7 +59,7 @@ int main(int argc,char **argv) to = now; from = now - 600; - if (edg_wll_StateDurationFromTo(ctx,group,atoi(argv[2]),atoi(argv[3]), + if (edg_wll_StateDurationsFromTo(ctx,group,atoi(argv[2]),atoi(argv[3]), argc >=5 ? atoi(argv[4]) : 0, &from,&to,&durations,&dispersions, &groups,&from_res,&to_res)) { diff --git a/org.glite.lb.client/interface/statistics.h b/org.glite.lb.client/interface/statistics.h index 9cc79c3..952859d 100644 --- a/org.glite.lb.client/interface/statistics.h +++ b/org.glite.lb.client/interface/statistics.h @@ -46,18 +46,41 @@ int edg_wll_StateRate( int minor, time_t *from, time_t *to, - float **rates, - char ***groups, + float *rates, int *res_from, int *res_to ); +int edg_wll_StateRates( + edg_wll_Context context, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode major, + int minor, + time_t *from, + time_t *to, + float **rates, + char ***groups, + int *res_from, + int *res_to +); /** Compute average time for which jobs stay in the specified state. * \see edg_wll_StateRate for description of parameters. */ int edg_wll_StateDuration( + edg_wll_Context context, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode major, + int minor, + time_t *from, + time_t *to, + float *duration, + int *res_from, + int *res_to +); + +int edg_wll_StateDurations( edg_wll_Context context, const edg_wll_QueryRec *group, edg_wll_JobStatCode major, @@ -78,6 +101,21 @@ int edg_wll_StateDurationFromTo( int minor, time_t *from, time_t *to, + float *durations, + float *dispersions, + int *res_from, + int *res_to +); + + +int edg_wll_StateDurationsFromTo( + 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 **durations, float **dispersions, char ***groups, diff --git a/org.glite.lb.client/src/statistics.c b/org.glite.lb.client/src/statistics.c index f3e33a6..da9b56f 100644 --- a/org.glite.lb.client/src/statistics.c +++ b/org.glite.lb.client/src/statistics.c @@ -49,6 +49,33 @@ static int set_server_name_and_port(edg_wll_Context, const edg_wll_QueryRec **); */ int edg_wll_StateRate( + edg_wll_Context ctx, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode major, + int minor, + time_t *from, + time_t *to, + float *rate, + int *res_from, + int *res_to) + +{ + float *rates = NULL; + char **groups = NULL; + int i; + + edg_wll_StateRates(ctx, group, major, minor, from, to, &rates, &groups, res_from, res_to); + if (groups && groups[0]){ + *rate = rates[0]; + free(rates); + for (i = 0; groups[i]; i++) + free(groups[i]); + free(groups); + } + return edg_wll_Error(ctx, NULL, NULL); +} + +int edg_wll_StateRates( edg_wll_Context ctx, const edg_wll_QueryRec *group, edg_wll_JobStatCode major, @@ -97,6 +124,33 @@ err: */ int edg_wll_StateDuration( + edg_wll_Context ctx, + const edg_wll_QueryRec *group, + edg_wll_JobStatCode major, + int minor, + time_t *from, + time_t *to, + float *duration, + int *res_from, + int *res_to) +{ + float *durations; + char **groups; + int i; + + edg_wll_StateDurations(ctx, group, major, minor, from, to, &durations, &groups, res_from, res_to); + if (groups && groups[0]){ + *duration = durations[0]; + free(durations); + for (i = 0; groups[i]; i++) + free(groups[i]); + free(groups); + } + + return edg_wll_Error(ctx, NULL, NULL); +} + +int edg_wll_StateDurations( edg_wll_Context ctx, const edg_wll_QueryRec *group, edg_wll_JobStatCode major, @@ -148,6 +202,40 @@ int edg_wll_StateDurationFromTo( const edg_wll_QueryRec *group, edg_wll_JobStatCode base, edg_wll_JobStatCode final, + int minor, + time_t *from, + time_t *to, + float *duration, + float *dispersion, + int *res_from, + int *res_to +) +{ + float *durations; + float *dispersions; + char **groups; + int i; + + edg_wll_StateDurationsFromTo(ctx, group, base, final, minor, from, to, + &durations, &dispersions, &groups, res_from, res_to); + if (groups && groups[0]){ + *duration = durations[0]; + *dispersion = dispersions[0]; + free(durations); + free(dispersions); + for (i = 0; groups[i]; i++) + free(groups[i]); + free(groups); + } + + return edg_wll_Error(ctx, NULL, NULL); +} + +int edg_wll_StateDurationsFromTo( + 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,