From f061d3a02c940acd54ea1ff2ce4c01751c652015 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Wed, 15 Oct 2008 16:53:31 +0000 Subject: [PATCH] initial implementation of state_history --- org.glite.lb.utils/Makefile | 5 ++- org.glite.lb.utils/src/state_history.c | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 org.glite.lb.utils/src/state_history.c diff --git a/org.glite.lb.utils/Makefile b/org.glite.lb.utils/Makefile index 3679bc5..c1634ff 100644 --- a/org.glite.lb.utils/Makefile +++ b/org.glite.lb.utils/Makefile @@ -55,7 +55,7 @@ COMMON_LIB:=-lglite_lb_common_${nothrflavour} CLIENT_LIB:=-lglite_lb_client_${nothrflavour} JP_LIBS:=-lglite_jp_common_${nothrflavour} -UTILS:=mon purge dump load dump_exporter +UTILS:=mon purge dump load dump_exporter state_history STATISTICS_OBJS:=statistics.o process_attrs.o process_attrs2.o MAN_GZ:=glite-lb-mon.1.gz @@ -72,6 +72,9 @@ ${UTILS}: %: %.o statistics: ${STATISTICS_OBJS} ${LINK} -rdynamic -o $@ ${STATISTICS_OBJS} ${COMMON_LIB} ${JP_LIBS} ${EXT_LIBS} +state_history: state_history.o + ${LINK} -o $@ state_history.o -L${stagedir}/lib -lglite_lb_statemachine ${CLIENT_LIB} ${COMMON_LIB} + check: compile doc: ${MAN_GZ} diff --git a/org.glite.lb.utils/src/state_history.c b/org.glite.lb.utils/src/state_history.c new file mode 100644 index 0000000..6fbdf6a --- /dev/null +++ b/org.glite.lb.utils/src/state_history.c @@ -0,0 +1,57 @@ +#include +#include +#include + +#include "glite/lb/context.h" +#include "glite/lb/consumer.h" + +#include "glite/lb/intjobstat.h" +#include "glite/lb/seqcode_aux.h" + +/*comment */ + +int main (int argc, char ** argv) +{ + edg_wll_Context ctx; + edg_wll_QueryRec jc[2]; + edg_wll_Event *events; + int i,n; + intJobStat is; + + memset(&jc,0,sizeof jc); + if (argc != 2 || glite_jobid_parse(argv[1],&jc[0].value.j)) { + fprintf(stderr,"usage: %s \n",argv[0]); + return 1; + } + + + edg_wll_InitContext(&ctx); + jc[0].attr = EDG_WLL_QUERY_ATTR_JOBID; + jc[0].op = EDG_WLL_QUERY_OP_EQUAL; + + if (edg_wll_QueryEvents(ctx,jc,NULL,&events)) { + char *ed,*et; + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"%s: %s (%s)\n",argv[1],et,ed); + return 1; + } + + for (n=0; events[n].type; n++); + + init_intJobStat(&is); + + qsort(events,n,sizeof *events,compare_events_by_seq); + + for (i=0; i