From 7fbace99cef9b25c9ebc8f29346e6ab279d84954 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Thu, 18 May 2006 22:16:29 +0000 Subject: [PATCH] perftest_logjobs - initial version --- org.glite.lb.client/Makefile | 17 ++++-- org.glite.lb.client/src/perftest_logjobs.c | 98 +++++++++++++++++++++++++++--- 2 files changed, 99 insertions(+), 16 deletions(-) diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index b7af80f..823c98b 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -73,6 +73,12 @@ endif ifdef LB_PERF LB_PERF_FLAGS:=-DLB_PERF -DLB_PERF_DROP + LB_PERF_TOOLS:=perftest_logjobs + COMMON_LIB:=-lglite_lb_common_perf_${nothrflavour} + COMMON_LIB_THR:=-lglite_lb_common_perf_${thrflavour} +else + COMMON_LIB:=-lglite_lb_common_${nothrflavour} + COMMON_LIB_THR:=-lglite_lb_common_${thrflavour} endif CFLAGS:=${DEBUG} \ @@ -105,7 +111,6 @@ EXT_LIB:= ${mysqlib} -lmysqlclient -lz\ TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit TEST_INC:=-I${cppunit_prefix}/include -COMMON_LIB=-lglite_lb_common_${nothrflavour} LDFLAGS:=-L${stagedir}/lib \ ${COVERAGE_FLAGS} @@ -144,7 +149,7 @@ FAKETHRLIB:=libglite_lb_client_fake_${thrflavour}.la PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la -TOOLS:=dump load purge lb_dump_exporter +TOOLS:=dump load purge lb_dump_exporter ${LB_PERF_TOOLS} EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl stresslog EXAMPLES_CL=user_jobs job_status @@ -163,22 +168,22 @@ version_info:=-version-info ${shell \ ${LIB}: ${LIBOBJS} ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib \ - -lglite_lb_common_${nothrflavour} \ + ${COMMON_LIB} \ -lglite_security_gss_${nothrflavour} ${THRLIB}: ${LIBTHROBJS} ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${glite_location}/lib \ - -lglite_lb_common_${thrflavour} \ + ${COMMON_LIB_THR} \ -lglite_security_gss_${thrflavour} ${FAKELIB}: ${FAKELIBOBJS} ${LINK} ${version_info} -o $@ ${FAKELIBLOBJS} -rpath ${glite_location}/lib \ - -lglite_lb_common_${nothrflavour} \ + ${COMMON_LIB} \ -lglite_security_gss_${nothrflavour} ${FAKETHRLIB}: ${FAKELIBTHROBJS} ${LINK} ${version_info} -o $@ ${FAKELIBTHRLOBJS} -rpath ${glite_location}/lib \ - -lglite_lb_common_${thrflavour} \ + ${COMMON_LIB_THR} \ -lglite_security_gss_${thrflavour} ${PLUSLIB}: ${PLUSOBJS} diff --git a/org.glite.lb.client/src/perftest_logjobs.c b/org.glite.lb.client/src/perftest_logjobs.c index 39d5e70..c085e97 100644 --- a/org.glite.lb.client/src/perftest_logjobs.c +++ b/org.glite.lb.client/src/perftest_logjobs.c @@ -2,30 +2,108 @@ #include #include #include -#include -#include +#include -extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline); -extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline); +#include "glite/lb/lb_perftest.h" +/* extern char *optarg; extern int opterr,optind; -static struct option const long_options[] { - {"dst", required_arg, NULL, 0}, - { - {NULL, 0, NULL, 0} +Vzorem by mel byt examples/stresslog.c, ovsem s mirnymi upravami: + +1) nacte udalosti jednoho jobu z daneho souboru, rozparsuje a ulozi do pameti +2) je-li pozadan, zaregistruje dany pocet jobid +3) vypise timestamp +4) odesle rozparsovane udalosti pod ruznymi jobid (tolika, kolik ma + byt jobu - argument) na dany cil (localloger, interlogger, bkserver, proxy) +5) odesle specialni ukoncovaci udalost +6) exit + + read_job("small_job",&event_lines); + gettimeoday(&zacatek) + for (i=0; i<1000; i++) { + for (e=0; event_lines[e]; e++) + edg_wll_ParseEvent(event_lines[e],&event[e]); + } + gettimeofday(&konec); + + printf("parsovani",konec-zacatek/1000); + + gettimeofday(&zacatek); + switch (event[e].type) { + ... + edg_wll_LogBlaBla() + + +*/ + +static struct option const long_options[] = { + { "help", no_argument, 0, 'h' }, + { "dst", required_argument, NULL, 'd' }, + { "test", required_argument, NULL, 't' }, + { "file", required_argument, NULL, 'f'}, + { "num", required_argument, NULL, 'n'}, + { "lbproxy", no_argument, 0, 'x'}, + { NULL, 0, NULL, 0} }; void -print_usage(char *name) +usage(char *program_name) { - fprintf(stderr, "Usage: %s \n", name); + fprintf(stderr, "Usage: %s [-x] [-d destname] [-t testname] -f filename -n numjobs \n" + "-h, --help display this help and exit\n" + "-d, --dst destination host name\n" + "-t, --test name of the test\n" + "-f, --file name of the file with prototyped job events\n" + "-n, --num number of jobs to generate\n" + "-x, --lbproxy feed to LB Proxy\n", + program_name); } int main(int argc, char *argv[]) { + + char *destname= NULL,*testname = NULL,*filename = NULL; + int lbproxy = 0, num_jobs = 1; + int opt; + + opterr = 0; + + while ((opt = getopt_long(argc,argv,"hd:t:f:n:x", + long_options, (int *) 0)) != EOF) { + + switch (opt) { + case 'd': destname = (char *) strdup(optarg); break; + case 't': testname = (char *) strdup(optarg); break; + case 'f': filename = (char *) strdup(optarg); break; + case 'n': num_jobs = atoi(optarg); break; + case 'x': lbproxy = 1; break; + case 'h': + default: + usage(argv[0]); exit(0); + } + } + + if (num_jobs <= 0) { + fprintf(stderr,"%s: wrong number of jobs\n",argv[0]); + usage(argv[0]); + exit(1); + } + + if (!filename) { + fprintf(stderr,"%s: -f required\n",argv[0]); + usage(argv[0]); + exit(1); + } + + if (glite_wll_perftest_init(destname, NULL, testname, filename, num_jobs) < 0) { + fprintf(stderr,"%s: glite_wll_perftest_init failed\n",argv[0]); + } + + return 0; + } -- 1.8.2.3