From 64242d956c62e9375e99847fc9e05f3cf609a75f Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 7 Apr 2008 17:19:17 +0000 Subject: [PATCH] update git-svn-id: http://ltt.polymtl.ca/svn@2847 04897980-b3bd-0310-b5e0-8ef037075253 --- markers-test/runtest.sh | 72 +++++++++++++++++++++++++--- markers-test/test-mark-speed-edit.c | 3 ++ markers-test/test-mark-speed-empty.c | 3 ++ markers-test/test-mark-speed-opt.c | 3 ++ markers-test/test-mark-speed.c | 4 +- 5 files changed, 77 insertions(+), 8 deletions(-) diff --git a/markers-test/runtest.sh b/markers-test/runtest.sh index 152f41e1..6381cc14 100644 --- a/markers-test/runtest.sh +++ b/markers-test/runtest.sh @@ -1,5 +1,8 @@ #!/bin/sh +make clean +make #build no flush modules + ITER=10 LOOPS=2000 @@ -26,33 +29,88 @@ for a in `seq 1 $ITER`; do cat /proc/testmark;done rmmod test-mark-speed-edit RESNOP=`dmesg |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'` -echo "Results in cycles per loop" -echo "Cycles for wbinvd() loop (will be substracted from following results)" +make clean +make EXTRA_CFLAGS=-DCACHEFLUSH + +insmod test-mark-speed-empty.ko +for a in `seq 1 $ITER`; do cat /proc/testmark;done +rmmod test-mark-speed-empty +RESEMPFL=`dmesg |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'` + +insmod test-mark-speed.ko +for a in `seq 1 $ITER`; do cat /proc/testmark;done +rmmod test-mark-speed +RESSTDFL=`dmesg |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'` + +insmod test-mark-speed-opt.ko +for a in `seq 1 $ITER`; do cat /proc/testmark;done +rmmod test-mark-speed-opt +RESOPTFL=`dmesg |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'` + +insmod test-mark-speed-edit.ko +#Patch with nops +cat /proc/testmark + +for a in `seq 1 $ITER`; do cat /proc/testmark;done +rmmod test-mark-speed-edit +RESNOPFL=`dmesg |tail -n 10 |sed 's/^\[.*\] //'| sed 's/cycles : \(.*\)$/\1/'` + + + + +echo "Results in cycles per loop" +echo "Cycles for empty loop (will be substracted for cached runs)" SUM="0" for a in $RESEMP; do SUM=$[$SUM + $a]; done RESEMP=`echo $SUM/$ITER/$LOOPS | bc -l /dev/stdin` - echo $RESEMP -echo "Added cycles for normal marker" +echo "Cycles for wbinvd() loop (will be substracted non-cached runs)" +SUM="0" +for a in $RESEMPFL; do SUM=$[$SUM + $a]; done +RESEMPFL=`echo $SUM/$ITER/$LOOPS | bc -l /dev/stdin` +echo $RESEMPFL + +echo "Added cycles for normal marker (cached)" SUM="0" for a in $RESSTD; do SUM=$[$SUM + $a]; done RESSTD=`echo $SUM/$ITER/$LOOPS - $RESEMP | bc -l /dev/stdin` - echo $RESSTD -echo "Added cycles for optimized marker" +echo "Added cycles for normal marker (uncached)" +SUM="0" +for a in $RESSTDFL; do SUM=$[$SUM + $a]; done +RESSTDFL=`echo $SUM/$ITER/$LOOPS - $RESEMPFL | bc -l /dev/stdin` +echo $RESSTDFL + + + +echo "Added cycles for optimized marker (cached)" SUM="0" for a in $RESOPT; do SUM=$[$SUM + $a]; done RESOPT=`echo $SUM/$ITER/$LOOPS - $RESEMP | bc -l /dev/stdin` echo $RESOPT -echo "Added cycles for NOP replacement of function call" +echo "Added cycles for optimized marker (uncached)" +SUM="0" +for a in $RESOPTFL; do SUM=$[$SUM + $a]; done +RESOPTFL=`echo $SUM/$ITER/$LOOPS - $RESEMPFL | bc -l /dev/stdin` +echo $RESOPTFL + + +echo "Added cycles for NOP replacement of function call (cached)" SUM="0" for a in $RESNOP; do SUM=$[$SUM + $a]; done RESNOP=`echo $SUM/$ITER/$LOOPS - $RESEMP | bc -l /dev/stdin` echo $RESNOP +echo "Added cycles for NOP replacement of function call (uncached)" +SUM="0" +for a in $RESNOPFL; do SUM=$[$SUM + $a]; done +RESNOPFL=`echo $SUM/$ITER/$LOOPS - $RESEMPFL | bc -l /dev/stdin` +echo $RESNOPFL + + diff --git a/markers-test/test-mark-speed-edit.c b/markers-test/test-mark-speed-edit.c index adc7f2de..fc3deab2 100644 --- a/markers-test/test-mark-speed-edit.c +++ b/markers-test/test-mark-speed-edit.c @@ -64,7 +64,9 @@ struct proc_dir_entry *pentry = NULL; static inline void test(unsigned long arg, unsigned long arg2) { +#ifdef CACHEFLUSH wbinvd(); +#endif //asm volatile (""); //__my_trace_mark(1, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); test2(NULL, NULL, 2, current->pid, arg, arg2); @@ -114,4 +116,5 @@ void cleanup_module(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mathieu Desnoyers"); MODULE_DESCRIPTION("Marker Test"); +MODULE_VERSION("1.0"); diff --git a/markers-test/test-mark-speed-empty.c b/markers-test/test-mark-speed-empty.c index 20695ca8..0878610f 100644 --- a/markers-test/test-mark-speed-empty.c +++ b/markers-test/test-mark-speed-empty.c @@ -54,7 +54,9 @@ struct proc_dir_entry *pentry = NULL; static inline void test(unsigned long arg, unsigned long arg2) { +#ifdef CACHEFLUSH wbinvd(); +#endif asm volatile (""); //__my_trace_mark(1, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); //__my_trace_mark(0, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); @@ -103,4 +105,5 @@ void cleanup_module(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mathieu Desnoyers"); MODULE_DESCRIPTION("Marker Test"); +MODULE_VERSION("1.0"); diff --git a/markers-test/test-mark-speed-opt.c b/markers-test/test-mark-speed-opt.c index e0a26425..19a0b426 100644 --- a/markers-test/test-mark-speed-opt.c +++ b/markers-test/test-mark-speed-opt.c @@ -54,7 +54,9 @@ struct proc_dir_entry *pentry = NULL; static inline void test(unsigned long arg, unsigned long arg2) { +#ifdef CACHEFLUSH wbinvd(); +#endif //asm volatile (""); //__my_trace_mark(1, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); __my_trace_mark(0, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); @@ -103,4 +105,5 @@ void cleanup_module(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mathieu Desnoyers"); MODULE_DESCRIPTION("Marker Test"); +MODULE_VERSION("1.0"); diff --git a/markers-test/test-mark-speed.c b/markers-test/test-mark-speed.c index 091d1f74..b3294e58 100644 --- a/markers-test/test-mark-speed.c +++ b/markers-test/test-mark-speed.c @@ -54,7 +54,9 @@ struct proc_dir_entry *pentry = NULL; static inline void test(unsigned long arg, unsigned long arg2) { +#ifdef CACHEFLUSH wbinvd(); +#endif //asm volatile (""); __my_trace_mark(1, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); //__my_trace_mark(0, kernel_debug_test, NULL, "%d %d %ld %ld", 2, current->pid, arg, arg2); @@ -103,4 +105,4 @@ void cleanup_module(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mathieu Desnoyers"); MODULE_DESCRIPTION("Marker Test"); - +MODULE_VERSION("1.0"); -- 2.34.1