From: František Dvořák Date: Mon, 15 Oct 2012 16:58:30 +0000 (+0000) Subject: Increase of padding in data structures, at least 25% reserved space for both 32-bit... X-Git-Tag: glite-jobid-api-c_R_2_2_3_1~5 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=268dd458db274c5451b61613c25cfb7287e80a47;p=jra1mw.git Increase of padding in data structures, at least 25% reserved space for both 32-bit and 64-bit architectures. L&B is compiling on 32-bit now. --- diff --git a/org.glite.lb.common/Makefile b/org.glite.lb.common/Makefile index 8c9cfca..b0db5ad 100644 --- a/org.glite.lb.common/Makefile +++ b/org.glite.lb.common/Makefile @@ -34,7 +34,7 @@ SOURCES=\ m4/*.m4 \ project/.post* \ src/*.c src/*.c.T src/*.sh \ - test/*.cpp test/*.cpp.T \ + test/*.c test/*.cpp test/*.cpp.T \ LICENSE Makefile SOURCES_EXEC=src/*.sh @@ -222,6 +222,9 @@ test_coverage: cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check cd coverage && for i in ${OBJS}; do gcov -o .libs/ $$i ; done +padding: padding.o + ${LINK} $< -o $@ + cjobid.c strmd5.c: if [ ! -d ${jobiddir} ]; then echo "Directory ${jobiddir} not found"; exit 1; fi mkdir -p glite/jobid @@ -257,7 +260,8 @@ install: ${STAGE_PERFTEST} ; clean: - rm -rvf *.o *.lo .libs lib* *.c *.h *.dox C/ CPP/ test_parse il_test parse.cpp events.tex status.tex test_query_rec + rm -rvf *.o *.lo .libs lib* *.c *.h *.dox C/ CPP/ + rm -fv test_parse il_test parse.cpp events.tex status.tex test_query_rec padding rm -rvf ${REPORTS} rm -rvf dist ${package}-*.tar.gz diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index 7d1b5ed..7484812 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -73,7 +73,7 @@ typedef struct _edg_wll_ConnProxy edg_wll_ConnProxy; /* !!! if adding something malloc-able, update edg_wll_FreeContext too !!! */ -glite_lb_padded_struct(_edg_wll_Context,150, +glite_lb_padded_struct(_edg_wll_Context,200, /// XXX: branch value: glite_lb_padded_struct(_edg_wll_Context,120, /* Error handling */ int errCode; /* recent error code */ diff --git a/org.glite.lb.common/interface/events.h.T b/org.glite.lb.common/interface/events.h.T index c3cb1e6..37642b8 100644 --- a/org.glite.lb.common/interface/events.h.T +++ b/org.glite.lb.common/interface/events.h.T @@ -380,7 +380,7 @@ _EDG_WLL_EVENT_COMMON * \union edg_wll_Event * \brief All event types union */ -glite_lb_padded_union(_edg_wll_Event,30, +glite_lb_padded_union(_edg_wll_Event,32, edg_wll_EventCode type; /* it is probably never used */ edg_wll_AnyEvent any; @@@{ diff --git a/org.glite.lb.common/test/padding.c b/org.glite.lb.common/test/padding.c new file mode 100644 index 0000000..57ee8d1 --- /dev/null +++ b/org.glite.lb.common/test/padding.c @@ -0,0 +1,39 @@ +#define CC /* +gcc -W -Wall -g -O2 padding.c -o padding -I../../stage/usr/include +exit $? +*/ + +/* + * quick analysis of padding usage + */ + +#include + +#include "glite/lb/connpool.h" +#include "glite/lb/context-int.h" +#include "glite/lb/events.h" +#include "glite/lb/lb_plain_io.h" + + +void out(const char *name, size_t size, size_t padding) { + printf("%s:\n", name); + printf(" sizeof %lu padding %lu padno %d use %0.02f %%\n", size, padding, size/(sizeof(void *)), (double)(size - padding)/size*100); + printf("\n"); +} + + +int main() { + struct _edg_wll_ConnPool connpool; + struct _edg_wll_ConnProxy connproxy; + struct _edg_wll_Context context; + union _edg_wll_Event event; + struct _edg_wll_PlainConnection plainconnection; + + out("struct _edg_wll_ConnPool", sizeof(connpool), sizeof(connpool._padding)); + out("struct _edg_wll_ConnProxy", sizeof(connproxy), sizeof(connproxy._padding)); + out("struct _edg_wll_Context", sizeof(context), sizeof(context._padding)); + out("union _edg_wll_Event", sizeof(event), sizeof(event._pad) - sizeof(union _edg_wll_Event_to_pad__dont_use)); + out("struct _edg_wll_PlainConnection", sizeof(plainconnection), sizeof(plainconnection._padding)); + + return 0; +}